Commit graph

180947 commits

Author SHA1 Message Date
Igor Babaev
6d29c8527b MDEV-17354 Server crashes in add_key_field / .. / Item_func_null_predicate::add_key_fields
upon INSERT .. SELECT

The function Item *Item_direct_view_ref::derived_field_transformer_for_where()
erroneously did not strip off ref wrappers from references to materialized
derived tables / views. As a result the expressions that contained some
references of the type Item_direct_view_ref to columns of a materialized
derived table / view V were pushed into V incorrectly. This could cause
crashes for some INSERT ... SELECT statements.
2018-10-12 11:45:04 -07:00
Marko Mäkelä
81a5b6ccd5 MDEV-17433 Allow InnoDB start up with empty ib_logfile0 from mariabackup --prepare
A prepared backup from Mariabackup does not really need to contain any
redo log file, because all log will have been applied to the data files.

When the user copies a prepared backup to a data directory (overwriting
existing files), it could happen that the data directory already contained
redo log files from the past. mariabackup --copy-back) would delete the
old redo log files, but a user’s own copying script might not do that.
To prevent corruption caused by mixing an old redo log file with data
files from a backup, starting with MDEV-13311, Mariabackup would create
a zero-length ib_logfile0 that would prevent startup.

Actually, there is no need to prevent InnoDB from starting up when a
single zero-length file ib_logfile0 is present. Only if there exist
multiple data files of different lengths, then we should refuse to
start up due to inconsistency. A single zero-length ib_logfile0 should
be treated as if the log files were missing: create new log files
according to the configuration.

open_log_file(): Remove. There is no need to open the log files
at this point, because os_file_get_status() already determined
the size of the file.

innobase_start_or_create_for_mysql(): Move the creation of new
log files a little later, not when finding out that the first log
file does not exist, but after finding out that it does not exist
or it exists as a zero-length file.
2018-10-11 23:00:48 +03:00
Marko Mäkelä
b8944e8972 Fix a sign mismatch 2018-10-11 22:47:42 +03:00
Marko Mäkelä
6319c0b541 MDEV-13564: Replace innodb_unsafe_truncate with innodb_safe_truncate
Rename the 10.2-specific configuration option innodb_unsafe_truncate
to innodb_safe_truncate, and invert its value.

The default (for now) is innodb_safe_truncate=OFF, to avoid
disrupting users with an undo and redo log format change within
a Generally Available (GA) release series.
2018-10-11 15:10:13 +03:00
Marko Mäkelä
3448ceb02a MDEV-13564: Implement innodb_unsafe_truncate=ON for compatibility
While MariaDB Server 10.2 is not really guaranteed to be compatible
with Percona XtraBackup 2.4 (for example, the MySQL 5.7 undo log format
change that could be present in XtraBackup, but was reverted from
MariaDB in MDEV-12289), we do not want to disrupt users who have
deployed xtrabackup and MariaDB Server 10.2 in their environments.

With this change, MariaDB 10.2 will continue to use the backup-unsafe
TRUNCATE TABLE code, so that neither the undo log nor the redo log
formats will change in an incompatible way.

Undo tablespace truncation will keep using the redo log only. Recovery
or backup with old code will fail to shrink the undo tablespace files,
but the contents will be recovered just fine.

In the MariaDB Server 10.2 series only, we introduce the configuration
parameter innodb_unsafe_truncate and make it ON by default. To allow
MariaDB Backup (mariabackup) to work properly with TRUNCATE TABLE
operations, use loose_innodb_unsafe_truncate=OFF.

MariaDB Server 10.3.10 and later releases will always use the
backup-safe TRUNCATE TABLE, and this parameter will not be
added there.

recv_recovery_rollback_active(): Skip row_mysql_drop_garbage_tables()
unless innodb_unsafe_truncate=OFF. It is too unsafe to drop orphan
tables if RENAME operations are not transactional within InnoDB.

LOG_HEADER_FORMAT_10_3: Replaces LOG_HEADER_FORMAT_CURRENT.

log_init(), log_group_file_header_flush(),
srv_prepare_to_delete_redo_log_files(),
innobase_start_or_create_for_mysql(): Choose the redo log format
and subformat based on the value of innodb_unsafe_truncate.
2018-10-11 08:17:04 +03:00
Marko Mäkelä
07815d9555 Merge 10.1 into 10.2 2018-10-11 08:16:08 +03:00
Marko Mäkelä
940f0c78a4 MDEV-11487: Make row_ins_index_entry_set_vals() static 2018-10-11 08:14:56 +03:00
Sergei Petrunia
8d116d1686 MDEV-17181: rocksdb.allow_to_start_after_corruption fails on current 10.2
The test needs to be run with rocksdb_flush_log_at_trx_commit=1, otherwise
the changes do not survive a crash.
2018-10-10 14:39:57 +03:00
Jan Lindström
3c3c4ae225 MDEV-17403: Test failure on galera.galera_enum
Add wait on second node.
2018-10-10 09:17:10 +03:00
Marko Mäkelä
00b6c7d8fc MDEV-16946 innodb.alter_kill failed in buildbot with wrong result
Ensure that no redo log checkpoint occurs in a critical section
of a recovery test.
2018-10-10 06:31:43 +03:00
Vladislav Vaintroub
5b0b6660f6 MDEV-17413 - Don't crash in my_malloc_size_cb_func()
if thread specific memory is requested and current_thd is NULL.

Leave DBUG_ASSERT() in place, to check in DBUG version.
2018-10-09 18:44:10 +01:00
Sergei Petrunia
8b371e4b13 MDEV-16577: rocksdb.issue255 fails in buildbot
Make the testcase stable
2018-10-09 17:01:49 +03:00
Andrei Elkin
f517d8c742 MDEV-17346 parallel slave start and stop races to workers disappeared
The bug appears as a slave SQL thread hanging in
rpl_parallel_thread_pool::get_thread() while there are no slave worker
threads to awake it.

The reason of the hang is that at the parallel slave worker pool
activation the being stared SQL thread could read the worker pool size
concurrently with pool deactivation. At reading the SQL thread did not
employ necessary protection from a race.

Fixed with making the SQL thread at the pool activation first
to grab the same lock as potential deactivator also does prior
to access the pool size.
2018-10-08 19:46:34 +03:00
Thirunarayanan Balathandayuthapani
e9d9ca8c44 MDEV-16980 Wrongly set tablename len while opening the
table for purge thread

Problem:
=======
	Purge tries to fetch mdl lock for the whole table even though it tries
to open one of the partition. But table name length was wrongly set to indicate
the partition name too.

Solution:
========
- Table name length should identify the table name only not the partition name.
2018-10-08 21:40:18 +05:30
Igor Babaev
1ebe841fb8 MDEV-17382 Hash join algorithm should not be used to join materialized
derived table / view by equality

Now rows of a materialized derived table are always put into a
temporary table before join operation. If BNLH is used to join this
table with the result of a partial join then both operands of the
join are actually put into main memory. In most cases this is not
efficient.
We could avoid this by sending the rows of the derived table directly
to the join operation. However this kind of data flow is not supported
yet.
Fixed by not allowing usage of hash join algorithm to join a materialized
derived table if it's joined by an equality predicate of the form
f=e where f is a field of the derived table.
2018-10-08 00:31:37 -07:00
Igor Babaev
1eca49577e MDEV-17382 Hash join algorithm should not be used to join materialized
derived table / view by equality

Now rows of a materialized derived table are always put into a
temporary table before join operation. If BNLH is used to join this
table with the result of a partial join then both operands of the
join are actually put into main memory. In most cases this is not
efficient.
We could avoid this by sending the rows of the derived table directly
to the join operation. However this kind of data flow is not supported
yet.
Fixed by not allowing usage of hash join algorithm to join a materialized
derived table if it's joined by an equality predicate of the form
f=e where f is a field of the derived table.
2018-10-07 14:42:22 -07:00
Marko Mäkelä
1ff22b2062 MDEV-17289: Skip the test for non-debug server 2018-10-06 13:43:13 +03:00
Vladislav Vaintroub
acca321af3 CMake, Windows - reduce amount of noisy, irrelevant MESSAGE()s 2018-10-05 16:48:51 +01:00
Vladislav Vaintroub
8c2360dee8 MDEV-17373 Windows: application verifier stop "Attempt to use an unknown SOCKET" 2018-10-05 16:48:51 +01:00
Vladislav Vaintroub
7fefd53f94 MDEV-14581 Server does not clear diagnostics between sessions
Amend previous patch, so it works in all cases (also for "change user"
command, and for RESET CONNECTION in 10.3)
2018-10-05 16:48:51 +01:00
Marko Mäkelä
079d0a8724
Merge pull request #876 from tempesta-tech/tt-10.1-MDEV-17313-counter-race
MDEV-17313 Data race in ib_counter_t
2018-10-05 17:40:06 +03:00
Thirunarayanan Balathandayuthapani
33fadbfefc MDEV-17289: Add a test case 2018-10-05 17:36:31 +03:00
Michael Widenius
1e06daea7c Remove not used variable 2018-10-05 14:25:40 +03:00
Michael Widenius
6c97e85673 Remove valgrind warnings from Item_str_concat
This warning come from a copy() operation of type:
memcpy(ptr, ptr+A, B), which is safe but produces a warning
when run with valgrind.

To avoid the warning, I added copy_or_move() method which uses
memmove() instead of memcpy().

In 10.3 the change in item_strfunc::Item_func_concat() has to be mirroed
in Item_func_concat_oracle() to avoid future valgrind warnings.
2018-10-05 14:25:40 +03:00
Marko Mäkelä
29703e4f87 Fix a Galera result 2018-10-05 16:45:58 +05:30
Thirunarayanan Balathandayuthapani
6f2389b22d - Added flush table at the beginning of crash_recovery test case. 2018-10-05 16:45:27 +05:30
Thirunarayanan Balathandayuthapani
2af67150cf MDEV-17289 Multi-pass recovery fails to apply some redo log records
This is a regression caused by
commit 73af8af094
(MDEV-15325 Incomplete validation of missing tablespace during recovery).

If the recv_sys->addr_hash hash table ran out of memory, we would
have to do crash recovery in multiple passes. If some tablespaces were
missing, after the MDEV-15325 fix we would rescan the remaining redo log.
But, we could incorrectly reset the "rescan" flag. Because of this, we
would fail to apply some of the oldest redo log records to the data files.
(The recv_sys->addr_hash would only contain records from the latest
redo log scan batch.)

Fix:

After checking for missing tablespaces, reset the flag rescan=true,
so that all redo log records will be re-read and applied.
2018-10-05 16:44:51 +05:30
Sergey Vojtovich
1655053ac1 MDEV-17200 - pthread_detach called for already detached threads
pthread_detach_this_thread() was intended to be defined to something
meaningful only on some ancient unixes, which don't have
pthread_attr_setdetachstate() defined. Otherwise, on normal unixes,
threads are created detached in the first place.

This was broken in 0f01bf2676 so that
we started calling pthread_detach() for already detached threads.
Intention was to detach aria checkpoint thread.

However in 87007dc2f7 aria service threads
were made joinable with appropriate handling, which makes breaking
revision unneccessary.

Revert remnants of 0f01bf2676, so that
pthread_detach_this_thread() is meaningful only on some ancient unixes
again.
2018-10-05 14:37:15 +04:00
Jan Lindström
e855912733 Test by reverting MDEV-16656: DROP DATABASE crashes the Galera Cluster 2018-10-04 13:29:29 +03:00
Jan Lindström
6c29544c20 Enable for staging tree. 2018-10-04 08:05:50 +03:00
Jan Lindström
391b7f5bd1 Fix typo. 2018-10-04 08:04:55 +03:00
Jan Lindström
e2a1c58582 Fix test failure on wsrep.variables
SLES11 can't build currently latest Galera library version.
2018-10-04 07:13:30 +03:00
Jan Lindström
84a24d36d8 MDEV-17357: Test failure on galera.galera_pc_ignore_sb
Add wait until cluster has correct number of nodes.
2018-10-04 07:13:07 +03:00
Vladislav Vaintroub
753117fed0 AWS KMS plugin : more detailed message when API calls fail.
Output API function name, exception name, exception text
2018-10-03 23:59:08 +02:00
Vladislav Vaintroub
f67e050430 Update libmariadb 2018-10-03 14:29:16 +01:00
Eugene Kosov
15803fce92 MDEV-17313 Data race in ib_counter_t
ib_counter_t: make all reads/writes to m_counter relaxed atomical
2018-10-02 13:34:11 +03:00
Jan Lindström
649451ae0d
Merge pull request #875 from tempesta-tech/sysprg/MDEV-16656
MDEV-16656: DROP DATABASE crashes the Galera Cluster
2018-10-01 12:47:35 +03:00
Sachin
865237e5af Fix rpl_parallel_optimistic_nobinlog failure on binlog 2018-10-01 15:15:34 +05:30
Julius Goryavsky
c62e49d0cf MDEV-16656: DROP DATABASE crashes the Galera Cluster
When converting table identifiers to a new format,
some tables can be renamed twice, which subsequently
leads to the appearance of "false" auxiliary tables
belonging to another main (parent) table (which does
not actually have auxiliary tables).

This is because the table number is repeatedly added
to the aux_tables_to_rename vector inside the function
fts_check_and_drop_orphaned_tables.

To correct this error, we must add a check for the
occurrence of the table number in the aux_tables_to_rename
vector before adding a new element.

https://jira.mariadb.org/browse/MDEV-16656
2018-10-01 09:53:37 +02:00
Thirunarayanan Balathandayuthapani
b4e841648c MDEV-17215 Assertion `rw_lock_own(dict_operation_lock, RW_LOCK_S)
|| node->vcol_info.is_used()' failed

- Purge thread can acquire mdl lock while initializing the mysql template.
Set the vcol_info information before acquiring mdl lock.

- Purge thread doesn't need to use the virtual column info even though it is
requested. In that case, reset the virtual column info.
2018-10-01 13:23:33 +05:30
Eugene Kosov
0f709912fb MDEV-17306 rw_lock_x_lock_wait_func() double increments rw_x_spin_round_count
rw_lock_x_lock_wait_func(): remove duplicated logic added in incorrect merge

Affected counters are affected by InnoDB monitor. But they aren't stable and thus
can not be realiably tested.
2018-09-27 17:57:27 +03:00
Marko Mäkelä
f77071e0e8 Remove unused code
Some global function definitions were orphaned by a bug fix in
MySQL 5.7.14 more than 2 years ago.
Remove them.
5ed18d823c
2018-09-26 17:04:38 +03:00
Marko Mäkelä
304857764b MDEV-13564 Mariabackup does not work with TRUNCATE
Implement undo tablespace truncation via normal redo logging.

Implement TRUNCATE TABLE as a combination of RENAME to #sql-ib name,
CREATE, and DROP.
2018-09-25 17:29:43 +03:00
Daniel Bartholomew
d913f6611c bump the VERSION 2018-09-25 10:06:06 -04:00
Elena Stepanova
2dfb4a8abe Updated list of unstable tests for 10.2.18 2018-09-25 02:45:40 +03:00
Sergei Golubchik
339edd462f fixed auto-merge gone bad 2018-09-24 20:37:22 +02:00
Sergei Golubchik
dcbd51cee6 update libmariadb 2018-09-24 15:34:23 +02:00
Sergei Golubchik
5ae8fce50b Merge branch '10.1' into 10.2 2018-09-24 11:46:08 +02:00
Sergei Golubchik
76098f45b8 RocksDB: workaround a compiler error on ppc64le
storage/rocksdb/rdb_datadic.cc: In member function 'int myrocks::Rdb_key_def::unpack_integer(myrocks::Rdb_field_packing*, Field*, uchar*, myrocks::Rdb_string_reader*, myrocks::Rdb_string_reader*) const'
storage/rocksdb/rdb_datadic.cc:1781:1: internal compiler error: Segmentation fault
 }

on ppc64le, ubuntu bionic gcc 7.3.0 and debian stretch gcc 6.3.0

The error happens with -ftree-loop-vectorize when trying to vectorize
a particular loop (see Rdb_key_def::unpack_integer())

Compiler gets confused by __attribute__((optimize("O0")) that comes from
ha_rocksdb_proto.h. The intention of this __attribute__ was to prevent
function from being inlined (see ha_rocksdb.cc). Let's use a more
specific attribute that prevents inlining but does not confuse
loop vectorizer.
2018-09-23 19:17:56 +02:00
Sergei Golubchik
1fc5a6f30c Merge branch '10.0' into 10.1 2018-09-23 12:58:11 +02:00