Commit graph

179930 commits

Author SHA1 Message Date
Marko Mäkelä
5569b3eb09 MDEV-16041 Do not write for null update (properly fix MySQL Bug#29157)
InnoDB takes a lot of time to perform null updates. The reason is that
even though an empty update vector was created, InnoDB will go on to
write undo log records and update the system columns
DB_TRX_ID and DB_ROLL_PTR in the clustered index, and of course write
redo log for all this.

This could have been fixed properly in
commit 54a492ecac more than 10 years ago.
2018-04-26 20:56:14 +03:00
Marko Mäkelä
c5ea43fc99 innobase_init(): Remove some dead code
Remove the local variable srv_buf_pool_size_org, which was always 0.
In MySQL 5.7, InnoDB was made a mandatory storage engine, which would
force InnoDB to start up when executing
	mysqld --verbose --help
which is what mysql-test-run.pl is doing as a first step. With a
large innodb_buffer_pool_size, this would take a long time.
So, MySQL 5.7 includes a hack that starts up InnoDB with a smaller
buffer pool when the option --verbose is present.
2018-04-26 14:15:57 +03:00
Marko Mäkelä
6e04af1b78 Remove dead code HAVE_LZO1X
MariaDB uses HAVE_LZO, not HAVE_LZO1X (which was never defined).
Also, the variable srv_lzo_disabled was never defined or read
(only declared and assigned to, in unreachable code).
2018-04-26 12:59:13 +03:00
Marko Mäkelä
c026e2c006 MDEV-15507 Assertion failed in dict_check_sys_tables on upgrade from 5.5
The InnoDB system table column SYS_TABLES.MIX_LEN was repurposed
in InnoDB Plugin for MySQL 5.1, in
commit 91111174ee (MySQL 5.1.46).
Until MySQL 5.6, it only contained a flag DICT_TF2_TEMPORARY.

MySQL 5.6 introduced a number of flags that were transient
in nature. One of these was introduced in 5.6.5, originally
called DICT_TF2_USE_TABLESPACE and later renamed to
DICT_TF2_USE_FILE_PER_TABLE. MySQL 5.7.6 introduced logic
that insists that the flag be set for any table that does not
reside in a shared tablespace, breaking upgrade from MySQL 5.5.

MariaDB does not support shared tablespaces other than the
InnoDB system tablespace. Also, some dependencies on
SYS_TABLES.MIX_LEN were removed in an earlier fix:
MDEV-13084 MariaDB 10.2 crashes on corrupted SYS_TABLES.MIX_LEN field
(commit e813fe8622).

dict_check_sys_tables(): Remove a bogus debug assertion, and add a
comment that explains how DICT_TF2_USE_FILE_PER_TABLE is used.

dict_table_is_file_per_table(): Remove a bogus debug assertion.
2018-04-26 09:25:46 +03:00
Igor Babaev
f033fbd9f2 Changed the test case for MDEV-15571
It has been done to demonstrate that the fix of this bug is good for 10.3
as well. The previous test case is not good for this purpose because
10.2 and 10.3 use different rules for determining the types of recursive
CTEs.
2018-04-24 12:39:41 -07:00
Marko Mäkelä
7b5543b21d MDEV-15030 Add ASAN instrumentation to trx_t Pool
Pool::mem_free(): Poison the freed memory. Assert that it was
fully initialized, because the reuse of trx_t objects will
assume that the objects were previously initialized.

Pool::~Pool(), Pool::get(): Unpoison the allocated memory,
and mark it initialized.

trx_free(): After invoking Pool::mem_free(), unpoison
trx_t::mutex and trx_t::undo_mutex, because MutexMonitor
will access these even for freed trx_t objects.
2018-04-24 20:33:27 +03:00
Marko Mäkelä
8346acaf80 Pull request #522: Remove C++ register keyword 2018-04-24 13:00:09 +03:00
Eugene Kosov
7b2bdd8984 register keyword c++17 warning 2018-04-24 12:48:32 +03:00
Marko Mäkelä
39a4985520 Remove most 'register' use in C++
Modern compilers (such as GCC 8) emit warnings that the
'register' keyword is deprecated and not valid C++17.

Let us remove most use of the 'register' keyword.
Code in 'extra/' is not touched.
2018-04-24 12:48:27 +03:00
Marko Mäkelä
2a00bdeb4a Remove unused function FixNull() 2018-04-24 12:06:28 +03:00
Marko Mäkelä
36d28f210a MDEV-15865 Crash in dict_index_set_merge_threshold() on CREATE TABLE
Apply the contributed patch from
MySQL Bug #89126 create table panic on innobase_parse_hint_from_comment
by Yan Huang.
2018-04-24 11:53:04 +03:00
Marko Mäkelä
4cd7979c56 Merge 10.1 into 10.2 2018-04-24 09:39:45 +03:00
Marko Mäkelä
9c34a4124d Merge 10.0 into 10.1 2018-04-24 09:26:40 +03:00
Marko Mäkelä
5b79303b40 MDEV-15988 Crash in ./mtr mariabackup.undo_space_id
xb_assign_undo_space_start(): Correctly pass the length of
the buffer, so that the file name will not be truncated.
2018-04-24 09:19:34 +03:00
Marko Mäkelä
c7bb337248 MDEV-15723 Crash in INFORMATION_SCHEMA.INNODB_SYS_TABLES when accessing corrupted record
dict_load_table_low(): When flagging an error, assign *table = NULL.
Failure to do so could cause a crash if an error was flagged when
accessing INFORMATION_SCHEMA.INNODB_SYS_TABLES.
2018-04-23 16:19:50 +03:00
Jan Lindström
82d4f08186
Merge pull request #713 from codership/MDEV-15948
MDEV-15948 Fix error "Lost connection to MySQL server..." in test gal…
2018-04-23 14:25:34 +03:00
Marko Mäkelä
fcaf619400 Remove the "register" keyword 2018-04-23 13:04:58 +03:00
Marko Mäkelä
88b1905eda Fix -Wimplicit-fallthrough 2018-04-23 13:04:58 +03:00
Marko Mäkelä
01b2e773ef MDEV-15937 Assertion failure 'key->flags & 1' on ALTER TABLE
While the test case crashes a MariaDB 10.2 debug build only,
let us apply the fix to the earliest applicable MariaDB series (10.0)
to avoid any data corruption on a table-rebuilding ALTER TABLE
using ALGORITHM=INPLACE.

innobase_create_key_defs(): Use altered_table->s->primary_key
when a new primary key is being created.
2018-04-23 13:04:58 +03:00
Daniele Sciascia
63e5307afd MDEV-15948 Followup commit
* Increased timeout counter in galera_wait_ready.inc

* Replaced useless include/wait_until_ready.inc after start_mysqld.inc
  in galera_st_*.inc with wait_condition on cluster size.
2018-04-23 12:00:49 +02:00
Marko Mäkelä
619dc2b24f Fix test results after merge from 10.1 2018-04-23 09:44:39 +03:00
Thirunarayanan Balathandayuthapani
211842dd86 MDEV-15374 Server hangs and aborts with long semaphore wait or assertion `len < ((ulint) srv_page_size)' fails in trx_undo_rec_copy upon ROLLBACK on temporary table
Problem:
=======
InnoDB cleans all temporary undo logs during commit. During rollback
of secondary index entry, InnoDB tries to build the previous version
of clustered index. It leads to access of freed undo page during
previous transaction commit and it leads to undo log corruption.

Solution:
=========
During rollback, temporary undo logs should not try to build
the previous version of the record.
2018-04-23 11:22:58 +05:30
Jan Lindström
31a19683f5
Merge pull request #711 from codership/MDEV-15929
MDEV-15929 Fix lock wait timeout on `SELECT @@GLOBAL.WSREP_ON`
2018-04-23 07:46:45 +03:00
Marko Mäkelä
469a4b02ce Fix an intermittent test failure 2018-04-21 20:59:26 +03:00
Sergei Golubchik
f2433b8dd3 MDEV-10824 - Crash in CREATE OR REPLACE TABLE t1 AS SELECT spfunc()
followup for a3c980b381

same change in Locked_tables_list::unlink_from_list(), otherwise
thd->locked_tables_list will keep pointers to a free'd TABLE if
prelocked under lock tables.

This fixes a crash in main.create_or_replace on debug Win builds
after bcb36ee21e
2018-04-21 13:13:19 +02:00
Marko Mäkelä
ea94717983 Merge 10.1 into 10.2 2018-04-21 11:58:32 +03:00
Sergei Golubchik
9fffa9374c mysqltest: use do_stmt_close() not mysql_stmt_close()
do_stmt_close() is embedded-aware.

this fixes the failure of innodb.innodb_bug48024 --ps --embed
2018-04-20 20:58:46 +02:00
Daniele Sciascia
9e5671f1cc MDEV-15948 Fix error "Lost connection to MySQL server..." in test galera_sst_mysqldump
Test galera_sst_mysqldump often fails with error "2013: Lost connection
to MySQL server during query". The connection is lost after the test
restart one of the nodes. This happens because the server closes client
connections if it is joining a cluster through SST method mysqldump.
On unlucky runs of the test it is possible that mysqld is restarted,
and then mtr client is disconnected while it tries to determine if
galera is ready before going on with the test.
This patch rewrites galera_wait_ready.inc so that it is immune to
being disconnected.
2018-04-20 14:44:27 +02:00
Sergei Golubchik
587568b72a Merge branch '5.5' into 10.0 2018-04-20 14:33:24 +02:00
Sergei Golubchik
bcb36ee21e MDEV-15456 Server crashes upon adding or dropping a partition in ALTER under LOCK TABLE after ER_SAME_NAME_PARTITION
ALTER TABLE ... ADD PARTITION modifies the open TABLE structure,
and sets table->need_reopen=1 to reset these modifications
in case of an error.

But under LOCK TABLES the table isn't get reopened, despite need_reopen.

Fixed by reopening need_reopen tables under LOCK TABLE.
2018-04-20 10:24:44 +02:00
Sergei Golubchik
86718fda4e compiler warning
bad merge
2018-04-20 09:40:29 +02:00
Sergei Golubchik
51c415d97d Merge branch 'merge/merge-xtradb-5.5' into 5.5 2018-04-20 01:04:43 +02:00
Sergei Golubchik
4fd1c7e453 5.5.59-38.11 2018-04-20 01:02:08 +02:00
Sergei Golubchik
7828ba0df4 Bug#25471090: MYSQL USE AFTER FREE
in a specially crafted invalid packet, one can get end_pos < pos here
2018-04-19 22:49:19 +02:00
Sergei Golubchik
149c993b2c BUG#27216817: INNODB: FAILING ASSERTION: PREBUILT->TABLE->N_MYSQL_HANDLES_OPENED == 1
disable online alter add primary key for innodb, if the
table is opened/locked more than once in the current connection

(see assert in ha_innobase::add_index())
2018-04-19 22:37:37 +02:00
Sergei Golubchik
f1258e7cd2 BUG#26881798: SERVER EXITS WHEN PRIMARY KEY IN MYSQL.PROC IS DROPPED
test case
2018-04-19 22:32:27 +02:00
Sergei Golubchik
1a019d0801 Merge branch 'mysql/5.5' into 5.5 2018-04-19 22:31:26 +02:00
Sergei Petrunia
0c02c91bc1 MyRocks: MDEV-15911: Reduce debug logging on default levels in error log
MyRocks internally will print non-critical messages to
sql_print_verbose_info() which will do what InnoDB does in similar cases:
check if (global_system_variables.log_warnings > 2).
2018-04-19 14:13:28 +03:00
Sachin Setiya
efae12680e MDEV-15611 Due to the failure of foreign key detection, Galera...
slave node killed himself.

Problem:- If we try to delete table with foreign key and table whom it is
referring with wsrep_slave_threads>1 then galera tries to execute both
Delete_rows_log-event in parallel, which should not happen.

Solution:- This is happening because we do not have foreign key info in
write set. Upto version 10.2.7 it used to work fine. Actually it happening
because of issue in commit 2f342c4. wsrep_must_process_fk has changed to
make it similar to original condition.
2018-04-19 16:33:49 +05:30
Daniele Sciascia
3aa5f00e69 MDEV-15929 Fix lock wait timeout on SELECT @@GLOBAL.WSREP_ON
This patch fixes a lock wait timeout error on `SELECT @@GLOBAL.WSREP_ON`
in `wait_wsrep_ready.inc`:

```
--connection node_2
...
--source include/kill_galera.inc

--connection node_1
--source include/wait_until_connected_again.inc # This includes wait_wsrep_ready.inc

```

The problem is that on node_2, kill_galera.inc may return before
the node is killed. So node_1 may still see that node_1 is alive
and will attempt to sync wait when doing those `SELECT` statements.
But sync wait is doomed to fail given that node_1 is killed, hence
the lock wait timeout.
One possible fix is to disable wsrep_sync_wait before including
wait_until_connected_again.
However, it appears that including wait_until_connected_again is
not necessary at all in node_1, so this patch removes it altogether.
2018-04-19 10:48:29 +02:00
Thirunarayanan Balathandayuthapani
66c14d3a8d MDEV-14377 innodb_zip.cmp_per_index failed in buildbot, result length mismatch
- If select query chooses the index 'b' over clustered index then the issue
can happen. Changed the test case to use primary index for the select
query.
2018-04-18 13:52:30 +05:30
Thirunarayanan Balathandayuthapani
341edddc3d MDEV-15826 Purge attempts to free BLOB page after BEGIN;INSERT;UPDATE;ROLLBACK
- During rollback, redo segments priorities over no-redo rollback
segments and it leads to failure of redo rollback segment undo
logs truncation.
2018-04-18 12:39:39 +05:30
Igor Babaev
1d98333ad9 MDEV-15894 Error, while using aggregated functions/window functions in anchor part
Usage of aggregate/window functions in non-recursive parts of recursive CTEs
is allowed. Error messages complaining about this were reported by mistake.
2018-04-17 10:35:55 -07:00
Sergei Golubchik
4f5dd1d40e ASAN error in main.statistics_index_crash-7362
one cannot do keyread on spatial indexes.
2018-04-17 10:13:20 +02:00
Igor Babaev
5e61e1716e MDEV-14515 ifnull result depends on number of rows in joined table
Any expensive WHERE condition for a table-less query with
implicit aggregation was lost. As a result the used aggregate
functions were calculated over a non-empty set of rows even
in the case when the condition was false.
2018-04-16 16:59:19 -07:00
Igor Babaev
e34d3184fd MDEV-15556 MariaDB crash with big_tables=1 and CTE
This bug manifested itself when the optimizer chose an execution plan with
an access of the recursive CTE in a recursive query by key and ARIA/MYISAM
temporary tables were used to store recursive tables.
The problem appeared due to passing an incorrect parameter to the call of
instantiate_tmp_table() in the function With_element::instantiate_tmp_tables().
2018-04-16 10:31:30 -07:00
Igor Babaev
612850782d MDEV-15571 Wrong results with big_tables=1 and CTE
The cause of this bug was the same as for the bug mdev-15575.
Fixed by the patch for the latter.
2018-04-16 08:55:15 -07:00
Igor Babaev
224f7af911 MDEV-15575 different results when using CTE and big_tables=1.
This bug happened due to a defect of the implementation of the handler
function ha_delete_all_rows() for the ARIA engine.
The function maria_delete_all_rows() truncated the table, but it didn't
touch the write cache, so the cache's write offset was not reset.
In the scenario like in the function st_select_lex_unit::exec_recursive
when first all records were deleted from the table and then several new
records were added some metadata became inconsistent with the state of
the cache. As a result the table scan function could not read records
at the end of the table.
The same defect could be found in the implementation of ha_delete_all_rows()
for the MYISAM engine mi_delete_all_rows().

Additionally made late instantiation for the temporary table used to store
rows that were used for each new iteration when executing a recursive CTE.
2018-04-16 07:22:26 -07:00
Sergei Golubchik
87af52d7dd MDEV-15866 Mysql CRASH : Json connect + MariaDB 10.3.4
revert incorrect change
2018-04-16 14:45:47 +02:00
Jan Lindström
3d1ad2a5e8 MDEV-13516: encryption.create_or_replace test fails in buildbot with InnoDB assertion failure
fil_crypt_rotate_pages
	If tablespace is marked as stopping stop also page rotation

fil_crypt_flush_space
	If tablespace is marked as stopping do not try to read
	page 0 and write it back.
2018-04-16 15:06:41 +03:00