Commit graph

180660 commits

Author SHA1 Message Date
Marko Mäkelä
1b4c5b7327 MDEV-16868 Same query gives different results
An INSERT into a temporary table would fail to set the
index page as modified. If there were no other write operations
(such as UPDATE or DELETE) to the page, and the page was evicted,
we would read back the old contents of the page, causing
corruption or loss of data.

page_cur_insert_rec_write_log(): Call mtr_t::set_modified()
for temporary tables. Normally this is part of the mlog_open()
call, but the mlog_open() call was only present in debug builds.
This regression was caused by
commit 48192f963a
which was preparation for MDEV-11369 and supposed to affect
debug builds only.

Thanks to Thirunarayanan Balathandayuthapani for debugging.
2018-08-24 09:38:52 +03:00
Marko Mäkelä
c164d0cc62 fil_name_process(): Remove unused return value 2018-08-23 17:02:50 +03:00
Marko Mäkelä
9a815401c6 MDEV-17043 Purge of indexed virtual columns may cause hang on table-rebuilding DDL
When a table is renamed to an internal #sql2 or #sql-ib name during
a table-rebuilding DDL operation such as OPTIMIZE TABLE or ALTER TABLE,
and shortly after that a purge operation in an index on virtual columns
is attempted, the operation could fail, but purge would fail to release
the table reference.

innodb_acquire_mdl(): Release the reference if the table name is not
valid for acquiring a meta-data lock (MDL).

innodb_find_table_for_vc(): Add a debug assertion if the table name
is not valid. This code path is for DML execution. The table
should have a valid name for executing DML, and furthermore a MDL
will prevent the table from being renamed.

row_vers_build_clust_v_col(): Add a debug assertion that both indexes
must belong to the same table.
2018-08-23 13:11:11 +03:00
Sergei Golubchik
5d650d366d MDEV-16961 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed upon concurrent DELETE and DDL with virtual blob column
After iterating all fields and setting PART_INDIRECT_KEY_FLAG as
necessary, TABLE::mark_columns_used_by_virtual_fields() remembers
in TABLE_SHARE that this operation was done and need not be repeated.

But as the flag is set in TABLE_SHARE, PART_INDIRECT_KEY_FLAG must
be set in TABLE_SHARE::field[], not only in TABLE::field[].

Otherwise all new TABLEs opened from this TABLE_SHARE will
never have it.
2018-08-22 22:18:44 +02:00
Marko Mäkelä
b0ef1b388b After-merge fix: Revert MDEV-15511
My conflict resolution for the script did not work out after all,
and apparently I was testing a wrong version. Revert MDEV-15511
from MariaDB 10.2 for now.
2018-08-21 16:52:59 +03:00
Marko Mäkelä
9258097fa3 Merge 10.1 into 10.2 2018-08-21 15:20:34 +03:00
Marko Mäkelä
dc7c080369 MDEV-17026 Assertion srv_undo_sources || ... failed on slow shutdown
trx_purge_add_update_undo_to_history(): Relax the too strict assertion
by removing the condition on srv_fast_shutdown (innodb_fast_shutdown).
Rollback is allowed during any form of shutdown.
2018-08-21 12:33:41 +03:00
Marko Mäkelä
45dbd47026 MDEV-17003 service_manager_extend_timeout() being called too often
buf_dump(): Only generate the output when shutdown is in progress.

log_write_up_to(): Only generate the output before actually writing
to the redo log files.

srv_purge_should_exit(): Rate-limit the output, and instead of
displaying the work done, indicate the work that remains to be done
until the completion of the slow shutdown.
2018-08-21 12:33:40 +03:00
Marko Mäkelä
cdc8debcaa MDEV-16557 Remove INNOBASE_SHARE 2018-08-21 12:10:21 +03:00
Marko Mäkelä
cccdb176a6 MDEV-16862 build failure for WITH_INNODB_AHI=0
Fix the build, which was broken by MDEV-16515.
2018-08-21 12:10:18 +03:00
Oleksandr Byelkin
b4210f3640 Merge branch '10.0' into 10.1 2018-08-21 10:07:26 +02:00
Galina Shalygina
0de3c423cc MDEV-16765: Missing rows with pushdown condition defined with CASE using Item_cond
The bug appears because of the wrong pushdown into the WHERE clause of the
materialized derived table/view work. For the excl_dep_on_grouping_fields()
method that checks if the condition can be pushed into the WHERE clause
the case when Item_cond is used is missing. For Item_cond elements this
method always returns positive result (that condition can be pushed).
So this condition is pushed even if is shouldn't be pushed.

To fix it new Item_cond::excl_dep_on_grouping_fields() method is added.
2018-08-20 17:42:49 +03:00
Igor Babaev
862a97749d MDEV-17011 “condition_pushdown_for_derived” optimization not used when
using INSERT INTO

This patch allows condition pushdown into a materialized derived / view when
this table is used in INSERT SELECT, multi-table UPDATE and multi-table DELETE.
2018-08-17 19:29:01 -07:00
Igor Babaev
4eac5df3fc MDEV-16934 Query with very large IN clause lists runs slowly
This patch introduces support for the system variable eq_range_index_dive_limit
that existed in MySQL starting from 5.6. The variable sets a limit for
index dives into equality ranges. Index dives are performed by optimizer
to estimate the number of rows in range scans. Index dives usually provide
good estimate but they are pretty expensive. To estimate the number of rows
in equality ranges statistical data on indexes can be employed. Its usage gives
not so good estimates but it's cheap. So if the number of equality dives
required by an index scan exceeds the set limit no dives for equality
ranges are performed by the optimizer for this index.

As the new system variable is introduced in a stable version the default
value for it is set to a special value meaning there is no limit for the number
of index dives performed by the optimizer.

The patch partially uses the MySQL code for WL 5957
'Statistics-based Range optimization for many ranges'.
2018-08-17 14:28:39 -07:00
Marko Mäkelä
d6f7fd6016 MDEV-13564: Refuse MLOG_TRUNCATE in mariabackup
The MySQL 5.7 TRUNCATE TABLE is inherently incompatible
with hot backup, because it is creating and deleting a separate
log file, and it is not writing redo log for all changes of the
InnoDB data dictionary tables. Refuse to create a corrupted backup
if the unsafe form of TRUNCATE was executed.

Note: Undo log tablespace truncation cannot be detected easily.
Also it is incompatible with backup, for similar reasons.

xtrabackup_backup_func(): "Subscribe to" the log events before
the first invocation of xtrabackup_copy_logfile().

recv_parse_or_apply_log_rec_body(): If the function pointer
log_truncate is set, invoke it to report MLOG_TRUNCATE.
2018-08-16 16:10:18 +03:00
Marko Mäkelä
1b49c89429 Re-enable the test mariabackup.unsupported_redo
Remove the logic for skipping the test if a log checkpoint occurred,
and the logic for tolerating failures. Thanks to MDEV-16791,
MLOG_INDEX_LOAD is supposed to always work.
2018-08-16 16:09:51 +03:00
Vladislav Vaintroub
f926c5f4fa MDEV-16996 mariabackup --prepare does not use native AIO on Linux by default 2018-08-16 08:37:54 +01:00
Marko Mäkelä
05153a670d Report all redo log corruption
Amend commit b853b4fd88
that was reverted in commit 29150e2391.

recv_parse_log_recs(): Do check for corrupted redo log or file
system before checking for len==0, but only read *ptr if
it is not past the end of the buffer (end_ptr).

recv_parse_log_rec(): Report incorrect redo log type
in a consistent way with recv_parse_or_apply_log_rec_body().
This is a follow-up to commit f30c5af42e.
2018-08-16 06:37:52 +03:00
Marko Mäkelä
a0ce321627 MDEV-16136 Various ASAN failures after MDEV-15030
The Pool poisoning that was introduced in MDEV-15030 introduced
race conditions in AddressSanitizer builds, because concurrent
poisoning and unpoisoning were not prevented by any synchronization
primitive.

Pool::get(): Protect the unpoisoning by m_lock_strategy.

Pool::mem_free(): Protect the poisoning by m_lock_strategy.

Pool::putl(): Renamed from put(), because now the caller is
responsible for invoking m_lock_strategy.
2018-08-16 05:55:17 +03:00
Marko Mäkelä
fa2a74e08d MDEV-16136: Prevent wrong reuse in trx_reference()
If trx_free() and trx_create_low() were called while a call to
trx_reference() was pending, we could get a reference to a wrong
transaction object.

trx_reference(): Return NULL if the trx->id no longer matches.

lock_trx_release_locks(): Assign trx->id = 0, so that trx_reference()
will not return a reference to this object.

trx_cleanup_at_db_startup(): Assign trx->id = 0.

assert_trx_is_free(): Assert !trx->n_ref. Assert trx->id == 0,
now that it will be cleared as part of a transaction commit.
2018-08-16 05:54:11 +03:00
Marko Mäkelä
6583506570 Rename lock_pool_t to lock_list
Also, replace reverse iteration with forward iteration.

lock_table_has(): Remove a redundant condition.
2018-08-16 05:53:50 +03:00
Marko Mäkelä
3ce8a0fc49 MDEV-16136: Simplify trx_lock_t memory management
Allocate trx->lock.rec_pool and trx->lock.table_pool directly from trx_t.
Remove unnecessary use of std::vector.

In order to do this, move some definitions from lock0priv.h to
lock0types.h, so that ib_lock_t will not be an opaque type.
2018-08-16 05:53:38 +03:00
Oleksandr Byelkin
bcc677bb72 Merge branch '5.5' into 10.0 2018-08-15 16:48:13 +02:00
Sergei Petrunia
b62ac16185 MDEV-6439: Server crashes in Explain_union::print_explain with explain in slow log, tis620 charset
Item_subselect::is_expensive() used to return FALSE (Inexpensive) whenever
it saw that one of SELECTs in the Subquery's UNION is degenerate. It
ignored the fact that other parts of the UNION might not be inexpensive,
including the case where pther parts of the UNION have no query plan yet.

For a subquery in form col >= ANY (SELECT 'foo' UNION SELECT 'bar')
this would cause the query to be considered inexpensive when there is
no query plan for the second part of the UNION, which in turn would
cause the SELECT 'foo' to compute and free itself while still inside
JOIN::optimize for that SELECT (See MDEV comment for full description).
2018-08-15 15:25:14 +03:00
Oleksandr Byelkin
1b797e9e63 MDEV-15475: Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed on EXPLAIN EXTENDED with constant table and view
Print constant ISNULL value independent.
Fix of printing of view FRM and CREATE VIEW output
2018-08-15 14:23:07 +02:00
Julius Goryavsky
75dfd4acb9 This is patch for the https://jira.mariadb.org/browse/MDEV-9519 issue:
If we have a 2+ node cluster which is replicating from an async master
and the binlog_format is set to STATEMENT and multi-row inserts are executed
on a table with an auto_increment column such that values are automatically
generated by MySQL, then the server node generates wrong auto_increment
values, which are different from what was generated on the async master.

The causes and fixes:

1. We need to improve processing of changing the auto-increment values
after changing the cluster size.

2. If wsrep auto_increment_control switched on during operation of
the node, then we should immediately update the auto_increment_increment
and auto_increment_offset global variables, without waiting of the next
invocation of the wsrep_view_handler_cb() callback. In the current version
these variables retain its initial values if wsrep_auto_increment_control
is switched on during operation of the node, which leads to inconsistent
results on the different nodes in some scenarios.

3. If wsrep auto_increment_control switched off during operation of the node,
then we must return the original values of the auto_increment_increment and
auto_increment_offset global variables, as the user has set. To make this
possible, we need to add a "shadow copies" of these variables (which stores
the latest values set by the user).
2018-08-15 14:17:28 +03:00
Vladislav Vaintroub
b795134802 MDEV-16859 MyRocks: support SSE42 CRC32-C instruction. 2018-08-15 11:18:49 +01:00
Jan Lindström
5960815630
Merge pull request #844 from codership/10.1-MDEV-15933
MDEV-15933 Cannot resume Node SYNCED state when wsrep_desync is done after FTWRL
2018-08-15 10:35:54 +03:00
Vladislav Vaintroub
68eb9b1a78 MDEV-16220 Do not pass UTF8 to mysql in command line parameters, on Windows
Moved parts of mysql.test to mysql_not_windows.test
2018-08-14 22:42:46 +02:00
Daniel Bartholomew
964ad0c426 bump the VERSION 2018-08-14 12:32:44 -04:00
Vladislav Vaintroub
922e7badfc MDEV-16791 mariabackup : Support DDL commands during backup 2018-08-14 15:11:13 +01:00
mkaruza
dfb19c06b8 MDEV-15933 Cannot resume Node SYNCED state when wsrep_desync is done after FTWRL
Manually setting wsrep_desync after FTWRL should not be allowed.
2018-08-14 12:06:21 +02:00
Vladislav Vaintroub
9a4998a35a adjust result file 2018-08-13 23:42:20 +01:00
Vladislav Vaintroub
1faaaa9718 MDEV-15680 xb_aws_key_management fails in buildbot.
aws_key_management needs current directory to be datadir during
initalization, it scans current directory for encrypted keys.

Fix is to ensure, that plugin initialization in mariabackup happens
after the call to my_setwd(mysql_real_data_home).
2018-08-13 22:39:31 +01:00
Vladislav Vaintroub
074b672b5d MDEV-16963 Tighten named pipe access control
Use real DACL instead of NULL DACL.
Grant Everyone just read/write access to pipe
(instead of all access like previously with NULL ACL)
2018-08-13 19:43:59 +01:00
Sergei Petrunia
562dd53c29 MDEV-16575: rocksdb.bulk_load_errors fails in buildbot with wrong result
Fix a race condition in the test.
2018-08-13 18:56:52 +03:00
Sergei Petrunia
ba10ffe0f4 MDEV-16203: autoinc_debug of rocksdb test suite fails
The test causes simulated server crashes with DBUG_SUICIDE();.

It also relies on transactions that were committed right before the
crash to be visible after the crash (that is, it requires durability).

Run the test with transaction durability enabled: set
rocksdb-flush-log-at-trx-commit=1.
2018-08-12 22:10:32 +03:00
Sergei Golubchik
3ff0801c73 MDEV-16810 AddressSanitizer: stack-buffer-overflow in int10_to_str
truncate incorrect values in convert_period_to_month() so that
PERIOD_DIFF never returns a value outside of 2^23 range.

And, for safety, increase buffer sizes for int10_to_str
to be sufficienly big for any int10_to_str result.
2018-08-11 12:19:46 +02:00
Otto Kekäläinen
9dd3e5ea3c Deb: Make libmariadb3 Breaks+Replaces libmariadbclient18 so upgrade pass
The package libmariadbclient18 contains the dialog.so plugin, which also
the new libmariadb3 ships. As they both use the exact same path the latter
must be marked as a with Breaks and Replaces relations ship.

Note: This fix is conservative hack for stable releases 10.2 and 10.3.
In 10.4, the development release at the time, we will clean up how the
libmariadb3 packaging and it's -compat packages are done to match that
what is done in downstream Debian official.
2018-08-10 18:32:35 +03:00
Marko Mäkelä
29150e2391 Revert part of b853b4fd88
recv_parse_log_recs(): Do not check for corruption before
checking for end-of-log-buffer. For some reason, adding the
check to the logical-looking place would cause intermittent
recovery failures in the tests innodb.innodb-index and
innodb_gis.rtree_compress2.
2018-08-10 17:01:53 +03:00
Marko Mäkelä
b853b4fd88 Report InnoDB redo log corruption better
recv_parse_log_recs(): Check for corruption before checking for
end-of-log-buffer.

mlog_parse_initial_log_record(), page_cur_parse_delete_rec():
Flag corruption for out-of-bounds values, and let the caller
dump the corrupted redo log extract.
2018-08-10 13:02:01 +03:00
Marko Mäkelä
0e15ae1602 recv_report_corrupt_log(): Avoid buffer overflow
If recv_sys_justify_left_parsing_buf() has been invoked, it is possible
that recv_previous_parsed_rec_offset is after the current offset.
In this case, we must not dump any bytes before the current record.
2018-08-10 10:00:47 +03:00
faust
0496bbc120 MDEV-15869 Mariabackup is lacking some dependencies declaration (#771)
* Backport from 10.4 to resolve dependency problem

Using the dependency syntax from 10.4 branch because {$LIBSSL} can not
be used.
2018-08-09 21:05:40 +03:00
Marko Mäkelä
bdf50c3ebd log_group_read_log_seg(): Validate the length
If the LOG_BLOCK_HDR_DATA_LEN field is corrupted, scanning the
log records could fail in strange ways. It is better to validate
the field as part of validating each log block.
2018-08-09 19:42:46 +03:00
Marko Mäkelä
f30c5af42e InnoDB: Correct an error message
Display the log record type in hexadecimal, not binary.
2018-08-09 17:38:40 +03:00
Sergei Golubchik
3f4274f8cd SLES11 OpenSSL 0.9.8 support 2018-08-09 11:29:15 +02:00
Sergei Golubchik
ba1c05cc0d compiler warning
warning: suggest a space before ‘;’ or explicit braces around empty body in ‘for’ statement
2018-08-09 11:28:38 +02:00
Sergei Golubchik
925b6ee048 update C/C up to v3.0.6 tag
update the test to the new (correct) result
2018-08-09 11:28:35 +02:00
Sergei Golubchik
eabf5230a2 MDEV-16906 No groups to be reported (check your GNRs) - mysqld_multi does not see instances
make mysqld_multi to use same rules for my.cnf directories
that all other tools are using (see my_default.c).
2018-08-07 21:11:15 +02:00
Sergei Golubchik
26e2dd39c5 Merge branch 'connect/10.2' into 10.2 2018-08-07 16:54:53 +02:00