Commit graph

182942 commits

Author SHA1 Message Date
Jacob Mathew
813b739850 MDEV-16246: insert timestamp into spider table from mysqldump gets wrong time zone.
The problem occurred because the Spider node was incorrectly handling
timestamp values sent to and received from the data nodes.

The problem has been corrected as follows:
- Added logic to set and maintain the UTC time zone on the data nodes.
  To prevent timestamp ambiguity, it is necessary for the data nodes to use
  a time zone such as UTC which does not have daylight savings time.
- Removed the spider_sync_time_zone configuration variable, which did not
  solve the problem and which interfered with the solution.
- Added logic to convert to the UTC time zone all timestamp values sent to
  and received from the data nodes.  This is done for both unique and
  non-unique timestamp columns.  It is done for WHERE clauses, applying to
  SELECT, UPDATE and DELETE statements, and for UPDATE columns.
- Disabled Spider's use of direct update when any of the columns to update is
  a timestamp column.  This is necessary to prevent false duplicate key value
  errors.
- Added a new test spider.timestamp to thoroughly test Spider's handling of
  timestamp values.

Author:
  Jacob Mathew.

Reviewer:
  Kentoku Shiba.

Cherry-Picked:
  Commit 97cc9d3 on branch bb-10.3-MDEV-16246
2018-07-09 16:09:20 -07:00
Marko Mäkelä
bbf780efcd Merge 10.2 into 10.3 2018-07-07 11:39:38 +03:00
Marko Mäkelä
1cc1d0429d MDEV-16664: Change the default to innodb_lock_schedule_algorithm=fcfs
The parameter innodb_lock_schedule_algorithm was introduced in
MariaDB Server 10.1.19, 10.2.13, 10.3.4 as part of MDEV-11039.
In MariaDB 10.1, the default value of the parameter is 'fcfs',
that is, the existing algorithm is used by default. But in
later versions of MariaDB Server, the parameter was 'vats',
enabling the new algorithm.

Because the new algorithm is triggering a debug assertion failure
that suggests corruption of the transactional lock data structures,
we will revert to the old algorithm by default until we have
resolved the problem.
2018-07-07 11:34:26 +03:00
Marko Mäkelä
934d5f95d3 Merge 10.2 into 10.3 2018-07-06 22:18:35 +03:00
Thirunarayanan Balathandayuthapani
8b0d4cff07 MDEV-15855 Deadlock between purge thread and DDL statement
Problem:
========
Truncate operation holds MDL on the table (t1) and tries to
acquire InnoDB dict_operation_lock. Purge holds dict_operation_lock
and tries to acquire MDL on the table (t1) to evaluate virtual
column expressions for indexed virtual columns.
It leads to deadlock of purge and truncate table (DDL).

Solution:
=========
If purge tries to acquire MDL on the table then it should do the following:

i) Purge should release all innodb latches (including dict_operation_lock)
before acquiring metadata lock on the table.

ii) After acquiring metadata lock on the table, it should check whether the
table was dropped or renamed. If the table is dropped then purge should
ignore the undo log record. If the table is renamed then it should
release the old MDL and acquire MDL on the new name.

iii) Once purge acquires MDL, it should use the SQL table handle for all
the remaining virtual index for the purge record.

purge_node_t: Introduce new virtual column information to know whether
the MDL was acquired successfully.

This is joint work with Marko Mäkelä.
2018-07-06 17:13:53 +03:00
Marko Mäkelä
e3207b6c13 MDEV-14188 mariabackup.incremental_encrypted wrong result
Add an explicit redo log flush. In this test
innodb_flush_log_at_trx_commit was 2 by default.
It is also possible that this failure occurs because of MDEV-15740.
2018-07-06 09:07:52 +03:00
Igor Babaev
e9b78a1055 Removed the test case for MDEV-15151 for the following reasons:
1. The changed variant did not fail without the patch for MDEV-16629
while the original test case did fail.
2. In any case the test case should go to cte_recursive_not_embedded.test
that was not created yet.
2018-07-05 15:10:47 -07:00
Marko Mäkelä
b4c377f215 Merge 10.2 into 10.3 2018-07-05 17:08:44 +03:00
Marko Mäkelä
1b335a74b4 Clean up a test
At the end of a test, 'connection default' should be in a usable state.
This was not the case, because there was a preceding 'send' without a
'reap'. If 'reap' was added, an error would be reported because the
server was restarted after the 'send'. It is easiest to 'send' from a
separate connection and do the restart from 'connection default'.
2018-07-05 16:47:54 +03:00
Thirunarayanan Balathandayuthapani
d897b4dc25 MDEV-15855: Use atomics for dict_table_t::n_ref_count
Make dict_table_t::n_ref_count private, and protect it with
a combination of dict_sys->mutex and atomics. We want to be
able to invoke dict_table_t::release() without holding
dict_sys->mutex.
2018-07-05 15:47:51 +03:00
Marko Mäkelä
fdb9e66fee Implement a parameter for wait_all_purged.inc 2018-07-05 15:47:13 +03:00
Marko Mäkelä
e9f1d8da57 Fix warnings about possibly uninitialized variables 2018-07-05 14:14:31 +03:00
Igor Babaev
058554027f MDEV-16629 "Table Does Not Exist" Error from Recursive CTE Query Inside Function
When processing a query containing with clauses a call of the function
check_dependencies_in_with_clauses() before opening tables used in the
query is necessary if with clauses include specifications of recursive
CTEs.
This call was missing if such a query belonged to a stored function.
This caused misbehavior of the server: it could report a fake error
as in the test case for MDEV-16629 or the executed query could hang
as in the test cases for MDEV-16661 and MDEV-15151.
2018-07-05 00:06:39 -07:00
Marko Mäkelä
1748a31ae8 MDEV-16675 Unnecessary explicit lock acquisition during UPDATE or DELETE
In InnoDB, an INSERT will not create an explicit lock object. Instead,
the inserted record is initially implicitly locked by the transaction
that wrote its trx_t::id to the hidden system column DB_TRX_ID.
(Other transactions would check if DB_TRX_ID is referring to a
transaction that has not been committed.)

If a record was inserted in the current transaction, it would be
implicitly locked by that transaction. Only if some other transaction
is requesting access to the record, the implicit lock should be
converted to an explicit one, so that the waits-for graph can be
constructed for detecting deadlocks and lock wait timeouts.

Before this fix, InnoDB would convert implicit locks to
explicit ones, even if no conflict exists.

lock_rec_convert_impl_to_expl(): Return whether caller_trx
already holds an explicit lock that covers the record.

row_vers_impl_x_locked_low(): Avoid a lookup if the record matches
caller_trx->id.

lock_trx_has_expl_x_lock(): Renamed from lock_trx_has_rec_x_lock().

row_upd_clust_step(): In a debug assertion, check for implicit lock
before invoking lock_trx_has_expl_x_lock().

rw_trx_hash_t::find(): Make do_ref_count a mandatory parameter.
Assert that trx_id is not 0 (the caller should check it).

trx_sys_t::is_registered(): Only invoke find() if id != 0.

trx_sys_t::find(): Add the optional parameter do_ref_count.

lock_rec_queue_validate(): Avoid lookup for trx_id == 0.
2018-07-03 15:10:06 +03:00
Marko Mäkelä
186a998b5b Merge 10.2 into 10.3 2018-07-03 10:25:38 +03:00
Marko Mäkelä
c3289d27ee Merge mariadb-10.3.8 into 10.3 2018-07-03 10:22:43 +03:00
Daniel Bartholomew
358ae4b46d bump the VERSION 2018-07-02 20:55:10 -04:00
Vladislav Vaintroub
400cf01715 MDEV-16571 - some backup tests sometimes with missing data after restore.
Marko mentions, it could be caused by  MDEV-15740 where InnoDB does not
flush redo log as often as it should, with innodb_flush_log_at_trx_commit=1

The workaround is to use innodb_flush_log_at_trx_commit=2, which,
according to MDEV-15740 is more durable.
2018-07-02 18:06:10 +01:00
Marko Mäkelä
71144afa96 Update result 2018-07-02 12:27:28 +03:00
Marko Mäkelä
e86d7108a2 Shorten some add_suppression
For some reason, some of these suppressions would fail to suppress
when the code is compiled with clang 6.0, Debug and -DWITH_ASAN=ON.
Possibly it is related to the number of .* or the length of the
regular expression strings.
2018-07-02 12:27:28 +03:00
Marko Mäkelä
502f1a3c11 MDEV-16623 ASAN: use-after-free in create_index()
Before attempting to create an index, copy any fields from
dict_table_t, because the table would be freed after a failed
index creation.
2018-07-02 12:27:28 +03:00
Sergei Golubchik
eaab98f702 after-merge fix 2018-07-02 09:30:10 +02:00
Thirunarayanan Balathandayuthapani
6e90c195ed MDEV-16365 Setting a column NOT NULL fails to return error for
NULL values when there is no DEFAULT

- Merged the alter_non_null test case to alter_not_null test case.
Renamed the alter_non_null_debug to alter_not_null_debug test case
2018-07-02 12:45:02 +05:30
Anel Husakovic
8639e28808 MDEV-16630: Ambiguous error message when check constraint matches table name
One can create table with the same name for `field` and `table` `check` constraint.
For example:
`create table t(a int check(a>0), constraint a check(a>10));`
But when inserting new rows same error is always raised.
For example with
```insert into t values (-1);```
and
```insert into t values (10);```
same error `ER_CONSTRAINT_FAILED` is obtained and it is not clear which constraint is violated.
This patch solve this error so that in case if field constraint is violated the first parameter
in the error message is `table.field_name` and if table constraint is violated the first parameter
in error message is `constraint_name`.
2018-07-01 22:32:55 +03:00
Sergei Golubchik
fc6fe26dc0 update C/C 2018-07-01 16:33:42 +02:00
Sergei Golubchik
f3ac221ffd Fix deb build failure on Xenial: disable -fPIE
Correct 898a8c3c0c to work when newer debhelper-10.2 is installed from
xenial-backports (or jessie-backports).

Use gcc version instead of debproxy version, this is likely a gcc
issue (as disabling LTO and gcc's linker plugin fixes it).
2018-07-01 16:10:59 +02:00
Vladislav Vaintroub
b71c9ae030 amend fix for MDEV-16596 - do not use CREATE_NEW flag when reopening redo log file.
use OPEN_ALWAYS instead, since we know file already exist.
2018-07-01 14:00:29 +01:00
Elena Stepanova
872e9a8ceb Updated list of unstable tests for 10.3.8 release 2018-07-01 02:51:53 +03:00
Sergei Golubchik
36e59752e7 Merge branch '10.2' into 10.3 2018-06-30 16:39:20 +02:00
Aleksey Midenkov
7c0779da7c MDEV-16102 Wrong ER_DUP_ENTRY upon ADD UNIQUE KEY on versioned table
* ignore CHECK constraint for historical rows;
* FOREIGN KEY test case.

TODO:
MDEV-16301 IB: use real table name for error messages on ALTER

Closes tempesta-tech/mariadb#491
Closes #748
2018-06-30 16:12:45 +02:00
Eugene Kosov
b5184c7efb MDEV-15947 ASAN heap-use-after-free in Item_ident::print or in my_strcasecmp_utf8 or unexpected ER_BAD_FIELD_ERROR upon call of stored procedure reading from versioned table
Closes #728
2018-06-30 16:12:36 +02:00
Eugene Kosov
133cfe39f1 MDEV-15645 Assertion `table->insert_values' failed in write_record upon REPLACE into a view with underlying versioned table
Right temporary storage for system versioning operations is table->record[2],
not table->insert_values

Closes #712
2018-06-30 16:12:28 +02:00
Sergei Golubchik
7d42135959 MDEV-16485 Insert rows unable to execute correctly on slave's System-Versioned Tables
RBR not versioned -> versioned

do it for all write_row events, not only for WRITE_ROWS_EVENT_V1
2018-06-30 16:12:18 +02:00
Sergei Golubchik
65f7473cf9 fix for ctags 2018-06-30 16:12:13 +02:00
Vladislav Vaintroub
c612a1e77c MDEV-16596 : Windows - redo log does not work on native 4K sector disks.
Disks with native 4K sectors need 4K alignment and size for  unbuffered IO
(i.e for files opened with FILE_FLAG_NO_BUFFERING)

Innodb opens redo log with FILE_FLAG_NO_BUFFERING, however it always does
512byte IOs. Thus, the IO on 4K native sectors will fail, rendering
Innodb non-functional.

The fix is to check whether OS_FILE_LOG_BLOCK_SIZE is multiple of logical
sector size, and if it is not, reopen the redo log without
FILE_FLAG_NO_BUFFERING flag.
2018-06-30 11:04:51 +01:00
Vicențiu Ciorbaru
46857a860c Update travis test status and position in README file 2018-06-30 10:28:51 +03:00
Otto Kekäläinen
5ef4870bb3 Travis-CI: Ensure AWS key management plugin is not built nor packaged
Building this plugin which requires run-time access to network, uses a lot
of disk space and is slow was already partially disabled. This way we
also ensure that on cmake level it never runs even if it out of some
autodetection reason at times thought it could run.

This fixes the error message:
  fatal: unable to access 'https://github.com/awslabs/aws-sdk-cpp.git/':
  Problem with the SSL CA cert (path? access rights?)
2018-06-30 00:34:07 +03:00
Otto Kekäläinen
d6b26a8924 Travis-CI: Don't build nor package the embedded server to save disk space
Fixes errors on Travis like:
  cp: error writing debian/libmariadbd19//usr/lib/x86_64-linux-gnu/
  libmariadbd.so.19: No space left on device
2018-06-29 17:31:20 +03:00
Otto Kekäläinen
dbdaafb014 autobake-deb: Stop packaging plugins that are not built
This complements commit ecb0e0ade4 that
disabled a bunch of plugins from being built on Travis-CI (due to time
and disk space saving reasons).

When the plugins are not built, the packaging phase will fail due to
missing files. This change omits the files from packaging to the process
can complete successfully.
2018-06-29 17:28:43 +03:00
Teodor Mircea Ionita
ecb0e0ade4 autobake-deb: disable storage engines using -DPLUGIN 2018-06-29 13:57:36 +03:00
Teodor Mircea Ionita
4d637628d3 MDEV-16213: Travis whitespace fix and remove comment 2018-06-29 13:57:36 +03:00
Teodor Mircea Ionita
7b6e867288 MDEV-16213: Further improvements to the Travis config
* Exclude some storage engines from Travis to conserve
  build time and disk usage per job. Exluded:
  TOKUDB MROONGA SPIDER OQGRAPH PERFSCHEMA SPHINX
* Increase travis_wait from default 20m to 30 for MTR
* Use travis_wait for long running MTR command (wait
  30m instead of default 20m)
* Increase testcase-timeout to 20m for OSX, 2m for Linux
* Set ccache size only on Linux, adjust timeout again
* Increase cache push timeout to 5 mins
* Remove AWS defines, not needed
* Remove commented out ASAN rules, has been disabled
  previously since it has a significant impact on job
  runtime, should be used more in buildbot instead
* Misc cleanup and fixes
2018-06-29 13:57:36 +03:00
Teodor Mircea Ionita
1d5220ae23 MDEV-16213: Exclude more engines from autobake-deb.sh 2018-06-29 13:57:36 +03:00
Teodor Mircea Ionita
5cdc70b8a1 MDEV-16213: Improvements and adjustments to Travis config
Several improvements have been made so that builds run
faster and with fewer canceled jobs:

* Set ccache max size to 1GB. Was 512MB for Linux
(too low for MariaDB) and 5GB on macOS with defaults;

* Don't install libasan in Travis if not necessary.
Sicne ASAN is disabled for the time being, save
time/resources for other steps;

* Decrease number of parallel processes. To prevent
resource exhaustion leading to poor performance. According
to Travis docs, a max of 4 concurrent processses should be
run per job:
https://docs.travis-ci.com/user/common-build-problems/#My-build-script-is-killed-without-any-error

* Reconsider tests exec order and split huge main and rocksdb
test suites into their own job, decreasing the chance of going
over the Travis job execution limit and getting killed;

* Increase Travis testcase-timeout to 4 minutes. Occasionally
on Ubuntu target and frequently on macOS, many tests in main,
rpl, binlog suites take longer than 2 minutes, resulting in
many jobs failing, when in reality the failing tests didn't
get a chance to complete. From my testing, along with the other
speedups, i.e. increasing ccache size, a timeout of 4 minutes
should be Ok.  Revert to 3 minutes of necessary.

* Build with GCC and Clang version 5,6 only.

* Rename GCC_VERSION to CC_VERSION for clarity. We are using
two compilers after all, GCC and Clang.

* Stop using somewhat obsolete Clang4 in Travis. Also, was the
reason for the failing test suites in MDEV-15430.
2018-06-29 13:57:36 +03:00
Sergei Golubchik
1dd3c8f8ba Merge branch '10.1' into 10.2 2018-06-28 22:46:12 +02:00
Vladislav Vaintroub
04677f44c7 Innodb : do not use errno on Windows to print os_file_pwrite() error.
Use GetLastError() instead.
2018-06-28 17:23:05 +01:00
Sergei Golubchik
45cabf1017 MDEV-16615 ASAN SEGV in handler::print_error or server crash after error upon CREATE TABLE
table->in_use is not always set and a KILL signal can arrive anytime.
2018-06-28 16:17:21 +02:00
Andrei Elkin
8ca18294d5 MDEV-14014 Multi-Slave Replication Fail: bogus data in log event
MDEV-7257 made a dump thread to read from binlog concurrently with
writers as long as the read bytes are below a water-mark
(MYSQL_BIN_LOG::binlog_end_pos). However it appeared to be possible a
dump thread reader reach out for bytes past the water mark through a
feature of IO_CACHE that fills in the internal buffer and while doing
so it could read what the reader is not supposed to see (the bytes
above MYSQL_BIN_LOG::binlog_end_pos).

The issue is fixed with constraining the IO_CACHE buffer fill to respect
the watermark.

An added unit test proves reading from file is bound to an external
parameter
passed to {IO_CACHE::end_of_file} cache member.
2018-06-28 15:47:03 +02:00
Sergei Golubchik
16c14d7ba0 mark ed25519 stable 2018-06-28 15:46:57 +02:00
Alexander Barkov
724a5105cb MDEV-16584 SP with a cursor inside a loop wastes THD memory aggressively
Problem:

push_handler() created sp_handler_entry instances on THD::main_mem_root,
which is freed only after the SP instructions execution.
So in case of a CONTINUE HANDLER inside a loop (e.g. WHILE) this approach
leaked thread memory on every loop iteration.

Changes:
- Removing sp_handler_entry declaration, it's not really needed.
- Fixing the data type of sp_rcontext::m_handlers from
  Dynamic_array<sp_handler_entry*> to Dynamic_array<sp_instr_hpush_jump*>
- Fixing sp_rcontext::push_handler() to push the pointer to
  an sp_instr_hpush_jump instance to the handler stack.
  This instance contains everything we need.
  There is no a need to allocate anything else.
2018-06-28 16:55:42 +04:00