Commit graph

69379 commits

Author SHA1 Message Date
Thirunarayanan Balathandayuthapani
79b46ab2a6 MDEV-19541 InnoDB crashes when trying to recover a corrupted page
- Don't apply redo log for the corrupted page when innodb_force_recovery > 0.
- Allow the table to be dropped when index root page is
corrupted when innodb_force_recovery > 0.
2019-05-28 11:55:02 +03:00
Monty
3a871c39a9 Fixed monitor.test to handle statistics >= 10 2019-05-21 09:23:31 +03:00
Alexey Botchkov
71ee69c81c MDEV-17456 Malicious SUPER user can possibly change audit log configuration without leaving traces.
thread_pool_server_audit.result fixed.
2019-05-20 17:45:32 +04:00
Alexey Botchkov
d4e9a50e88 MDEV-17456 Malicious SUPER user can possibly change audit log configuration without leaving traces.
Fix for the SET GLOBAL server_audit_loggin=on; added.
2019-05-19 23:50:23 +04:00
Jan Lindström
395ce1dcb3 MDEV-16021: galera mtr test galera_evs_suspect_timeout crashed
Crash was timeout crash. Add correct waits for connections, wsrep
sync waits and auto increment offset save and restore.
2019-05-17 18:30:34 +03:00
Jan Lindström
cd87e4e134 MDEV-13549: Timeout in wait_condition.inc for PROCESSLIST
Use wsrep sync wait instead of unnecessary waits and
correct slave setting.
2019-05-17 18:30:34 +03:00
Jan Lindström
bc511443b1 MDEV-17061: Test failure on galera.galera_gcs_fc_limit
Remove unnecessary sleeps and fix wait_condition to use
wsrep_flow_control_paused i.e. we wait until flow control
pauses a transaction on master.
2019-05-17 18:30:28 +03:00
Sergei Golubchik
fae6539ef7 restore the correct test result 2019-05-17 16:56:22 +02:00
Alexey Botchkov
cd16d6d518 MDEV-13992 Implement JSON_MERGE_PATCH.
JSON_MERGE_PATCH implemented. Added JSON_MERGE_PRESERVE as a synonim for
the JSON_MERGE.
2019-05-17 11:53:58 +04:00
Marko Mäkelä
796486d19b MDEV-19485: Add a test case
The bug was introduced in MariaDB 10.4.0 by
commit 0e5a4ac253
but it is good to have a regression test for this scenario
in all applicable MariaDB versions.

Cover the purge of an undo log record that was written before
the completion of ADD SPATIAL INDEX.
2019-05-16 14:17:22 +03:00
Marko Mäkelä
c41407210c Merge 10.1 into 10.2 2019-05-16 11:55:18 +03:00
Varun Gupta
70a5fb49a7 Fixed the case when statistics were not getting read because
we had the statistics tables in the FROM list of the select.
The statistics for tables are not read in such cases, so we need
to check this case separately.
2019-05-16 14:15:59 +05:30
Varun Gupta
6ab9d1627a MDEV-19407: Assertion `field->table->stats_is_read' failed in is_eits_usable
Statistics were not read for a table when we had a CREATE TABLE query.
Enforce reading statistics for commands CREATE TABLE, SET and DO.
2019-05-16 08:33:06 +05:30
Robert Bindar
a941e58fb8 MDEV-788 mysqlimport should support the ability to disable foreign keys 2019-05-15 18:45:58 +04:00
Marko Mäkelä
409e210e74 MDEV-19449 Got error 168 for valid TRUNCATE (temporary) TABLE
Add the test case.

The parent commit, which cherry-picked the MDEV-17167 fix from 10.3
(commit bad2f1569d)
fixed the bug.
2019-05-14 15:30:23 +03:00
Sergey Vojtovich
95fb88d546 MDEV-17167 - InnoDB: Failing assertion: table->get_ref_count() == 0 upon
truncating a temporary table

TRUNCATE expects only one TABLE instance (which is used by TRUNCATE
itself) to be open. However this requirement wasn't enforced after
"MDEV-5535: Cannot reopen temporary table".

Fixed by closing unused table instances before performing TRUNCATE.
2019-05-14 15:23:09 +03:00
Sujatha
43bbf88dcb MDEV-19158: MariaDB 10.2.22 is writing duplicate entries into binary log
Problem:
========
We have a Master/Master Setup on two servers, but are only writing to one of
those servers (so it is essentially Master/Slave) We upgraded from 10.1.* to
10.2.22 last week and starting with the upgrade, we are getting duplicate key
errors on the slave. BINLOG=mixed.

Analysis:
=========
This issue happens with LOCK TABLES and binlog_format=MIXED combination. When an
UNSAFE statement is encountered in 'MIXED' mode, it is logged in the form of
'ROW' format. For all the tables that are part of LOCK TABLES list their table maps
are written into the binary log. For each table in the list a check is
done to see if 'check_table_binlog_row_based_done' flag is set or not. If it is not set
a check process is initiated to see if table qualifies for row based binary
logging or not and 'check_table_binlog_row_based_done' is set. This flag will be
cleared at the time of closing thread tables.

But there can be special cases where the LOCK TABLES contains more number of
tables but the unsafe query is actually using subset of tables from LOCK TABLES
list.

For example: LOCK TABLES locks t1,t2,t3 but the unsafe statement makes use of
only two tables t1,t3. In this case the 'check_table_binlog_row_based_done' flag
is enabled for table 't2' while writing table map, but 'close_thread_tables'
function call will not reset this flag. Since the flag is not cleared for table
't2' even a safe statement which used t2 will be logged in the form of row based
format.

This leads to an assert on debug builds and causes duplicate entries in release
builds. In release builds a statement is logged in the form of both ROW and
STATEMENT format. This causes the slave to fail with duplicate key error.

Fix:
===
During 'close_thread_tables' when LOCK TABLE modes are active "ha_reset" is done
for all the tables which were part of current statement. As mentioned in the
example 'ha_reset' is called for tables 't1' and 't3'. This will clear the
'check_table_binlog_row_based_done' flag. At this point add a check for the rest
of the tables to see if 'check_table_binlog_row_based_done' is enabled or not.
If enabled clear the flag.
2019-05-14 16:06:55 +05:30
Sujatha
d0d663f3db Merge branch '10.1' into 10.2 2019-05-14 16:05:09 +05:30
Sujatha
47637a3dd1 MDEV-11095: rpl.rpl_row_mysqlbinlog test fails if row annotation enabled
Problem:
=======
Whel rpl.rpl_row_mysqlbinlog test is executed as shown below it fails with
result content mismatch.

perl mtr rpl_row_mysqlbinlog --mysqld=--binlog-annotate-row-events=1

Analysis:
=========
When row annotations are enabled the actual query is written into the binlog
which helps users to understand the query, even when row based replication is
enabled.

For example: Simple insert in row based replication looks like shown below.

#190402 16:31:27 server id 1  end_log_pos 526 	Annotate_rows:
#Q> insert into t values (10)
#190402 16:31:27 server id 1  end_log_pos 566 	Table_map: `test`.`t` mapped to number 19
# at 566
#190402 16:31:27 server id 1  end_log_pos 600 	Write_rows: table id 19 flags: STMT_END_F

BINLOG '
B0GjXBMBAAAAKAAAADYCAAAAABMAAAAAAAEABHRlc3QAAXQAAQMAAQ==
B0GjXBcBAAAAIgAAAFgCAAAAABMAAAAAAAEAAf/+CgAAAA==
'/*!*/;
# at 600

The test creates some binary log events and redirects them into a SQL file.
Executes RESET MASTER and sources the SQL file back on clean master and verifies
that the data is available. Please refer following steps.

../client/mysqlbinlog ./var/mysqld.1/data/master-bin.000001 > test.sql
../client/mysql -uroot -S./var/tmp/mysqld.1.sock -Dtest  < test.sql
../client/mysqlbinlog ./var/mysqld.1/data/master-bin.000001 -v > row.sql

When the row based replication specific SQL file is sourced once again on master
the newly generated binlog will treat the entire "BASE 64" encoded event as
query and write it into the binary log.

Output from 'row.sql':

#Q> BINLOG '
#Q> B0GjXBMBAAAAKAAAADYCAAAAABMAAAAAAAEABHRlc3QAAXQAAQMAAQ==
#Q> B0GjXBcBAAAAIgAAAFgCAAAAABMAAAAAAAEAAf/+CgAAAA==
#190402 16:31:27 server id 1  end_log_pos 657 	Table_map: `test`.`t` mapped to number 23
# at 657
#190402 16:31:27 server id 1  end_log_pos 691 	Write_rows: table id 23 flags: STMT_END_F

BINLOG '
B0GjXBMBAAAAKAAAAJECAAAAABcAAAAAAAEABHRlc3QAAXQAAQMAAQ==
B0GjXBcBAAAAIgAAALMCAAAAABcAAAAAAAEAAQH+CgAAAA==
### INSERT INTO `test`.`t`
### SET
###   @1=10
'/*!*/;
# at 691


This is expected behaviour as we cannot extract query from BASE 64 encoded
input. This causes more number of binary logs to be generated when the test is
executed with row annotations.

The following lines from test assumes that only two binary logs will contain
entire data.

 --echo --- Test 4 Second Remote test --
---exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1
	--port=$MASTER_MYPORT master-bin.000001 > $MYSQLTEST_VARDIR/tmp/remote.sql
---exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1
	--port=$MASTER_MYPORT master-bin.000002 >> $MYSQLTEST_VARDIR/tmp/remote.sql

In a case when row annotations are enabled the data gets spread across four
binary logs. As test uses only the first two binary log files, data available in
other binary logs gets missed. Hence test fails with result content mismatch as
less data is avaialble.

Fix:
====
Use "-to-the-last" option of "mysqlbinlog" tool which will ensure that all the
available binary log specific contents are included in .sql file.
2019-05-14 13:03:06 +05:30
Marko Mäkelä
50999738ea Merge 10.1 into 10.2 2019-05-13 18:48:28 +03:00
Marko Mäkelä
26a14ee130 Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
Marko Mäkelä
2647fd101d MDEV-19445 heap-use-after-free related to innodb_ft_aux_table
Try to fix the race conditions between
SET GLOBAL innodb_ft_aux_table = ...;
and access to the INFORMATION_SCHEMA tables that depend on
this variable.

innodb_ft_aux_table: Replaces
fts_internal_tbl_name,fts_internal_tbl_name2. Just store the
user-specified parameter as is.

innodb_ft_aux_table_id: The table_id corresponding to
SET GLOBAL innodb_ft_aux_table, or 0 if the table does not exist
or does not contain FULLTEXT INDEX. If the table is renamed later,
the INFORMATION_SCHEMA tables will continue to refer to the table.
If the table is dropped or rebuilt, the INFORMATION_SCHEMA tables
will not find the table.
2019-05-13 17:16:42 +03:00
Vicențiu Ciorbaru
cb248f8806 Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
Vicențiu Ciorbaru
5543b75550 Update FSF Address
* Update wrong zip-code
2019-05-11 21:29:06 +03:00
Vicențiu Ciorbaru
c0ac0b8860 Update FSF address 2019-05-11 19:25:02 +03:00
Marko Mäkelä
8ce702aa90 MDEV-17540 Server crashes in row_purge after TRUNCATE TABLE
row_purge_upd_exist_or_extern_func(): Check for node->vcol_op_failed()
after row_purge_remove_sec_if_poss(), like row_purge_del_mark() did.
This avoids us dereferencing the node->table=NULL pointer.

The test case, submitted by Elena Stepanova, is not deterministic and
does not repeat the bug on 10.2. With the added loop, for me, it reliably
crashes 10.3 without the fix. I was unable to create a deterministic
test case for either 10.2 or 10.3.

Reviewed by Thirunarayanan Balathandayuthapani
2019-05-10 10:50:35 +03:00
Marko Mäkelä
b2f3755c8e Merge 10.1 into 10.2 2019-05-10 08:02:21 +03:00
Sergey Vojtovich
d0b73fb8d3 MDEV-16060 - InnoDB: Failing assertion: ut_strcmp(index->name, key->name)
A sequel to 9180e86 and 149b754.

ALTER TABLE ... ADD FOREIGN KEY may crash if parent table is updated
concurrently.

Block FK parent table updates even earlier, before intermediate child
table is created.

Use proper charset info for my_casedn_str() and don't update original
identifiers so that lower_cast_table_names == 2 is honoured.
2019-05-09 11:13:44 +04:00
Jan Lindström
9d3e2a7ca2 Merge 10.1 into 10.2 2019-05-08 20:05:30 +03:00
Galina Shalygina
f2e27d53da MDEV-19139: pushdown condition with Item_func_set_user_var
The bug occurs because Item_func_set_user var is allowed to be pushed
into materialized derived table/view.
To fix it excl_dep_on_table() as added to Item_func_set_user_var class
to prevent pushdown.
2019-05-08 13:23:34 +03:00
Thirunarayanan Balathandayuthapani
7b93d71a4b MDEV-19387 innodb_ft_result_cache_limit_32 fails on s390x
Fix:
====
1) Combined innodb_ft_result_cache_limit_32.test and
innodb_ft_result_cache_limit_64.test test case in sys_vars suite.

2) Use word_size.inc for combinations of innodb_ft_result_cache_limit test case.
2019-05-08 12:49:08 +05:30
Elena Stepanova
49ef1c75e3 Updated list of unstable tests for 10.2.24 2019-05-08 00:07:57 +03:00
Jan Lindström
db9622f1f5 MDEV-19405: Galera test failure on galera_parallel_autoinc_largetrx
Test case was not stable. Fixed also galera_parallel_autoinc_manytrx
as it has the same problem.
2019-05-07 12:51:59 +03:00
Oleksandr Byelkin
633946fb63 Merge branch '10.1' into 10.2 2019-05-06 18:07:40 +02:00
Eugene Kosov
c83f837053 MDEV-18214 remove some duplicated MONITOR counters
MONITOR_PENDING_LOG_WRITE
MONITOR_PENDING_CHECKPOINT_WRITE
MONITOR_LOG_IO: read values from log_t members instead of updating own
monitor variables
2019-05-06 16:00:15 +03:00
Oleksandr Byelkin
8cbb14ef5d Merge branch '10.1' into 10.2 2019-05-04 17:04:55 +02:00
Varun Gupta
4345868382 MDEV-18373: DENSE_RANK is not calculated correctly
Need to call split_sum_func if an aggregate function is part of order by
or partition by clause so that we have the required fields inside the temporary
table, as all the fields inside the partition by and order by clause of the
window function needs to be there in the temp table used for window function
computation.
2019-05-04 13:07:55 +05:30
Varun Gupta
a6ea799651 MDEV-14791: Crash with order by expression containing window functions
The issue here is that for a window function in the ORDER BY clause, we were not
creating an extra field in the temporary table for the window function
(which is contained in an expression).
So a call to split_sum_func is added to handle this case

Also we need to update all items that contain a window function
in the temp table during window function computation as filesort would need
these values to be updated to calculate the ORDER BY clause of the select.
2019-05-04 13:07:55 +05:30
Varun Gupta
e292c67bb2 MDEV-17781: Server crashes in next_linear_tab
For degenerate joins we may have JOIN::table_list as NULL, so instead
of using JOIN::top_join_tab_count use the function JOIN::exec_join_tab_cnt
to get the number of tables joined at the top level.
2019-05-04 13:07:55 +05:30
Oleksandr Byelkin
b85aa20065 Merge branch '5.5' into 10.1 2019-05-02 17:23:36 +02:00
Vladislav Vaintroub
4b0f010b88 MDEV-18544 "missing required privilege PROCESS on *.*" using mariabackup for SST
If required privilege is missing, dump the output from "SHOW GRANTS"
into mariabackup log.

This will help troubleshooting, and make the bug reproducible.
2019-05-02 14:25:24 +01:00
Thirunarayanan Balathandayuthapani
ada1074bb1 MDEV-14398 innodb_encryption_rotate_key_age=0 causes innodb_encrypt_tables to be ignored
The statement

SET GLOBAL innodb_encryption_rotate_key_age=0;

would have the unwanted side effect that ENCRYPTION=DEFAULT tablespaces
would no longer be encrypted or decrypted according to the setting of
innodb_encrypt_tables.

We implement a trigger, so that whenever one of the following is executed:

SET GLOBAL innodb_encrypt_tables=OFF;
SET GLOBAL innodb_encrypt_tables=ON;
SET GLOBAL innodb_encrypt_tables=FORCE;

all wrong-state ENCRYPTION=DEFAULT tablespaces will be added to
fil_system_t::rotation_list, so that the encryption will be added
or removed.

Note: This will *NOT* happen automatically after a server restart.
Before reading the first page of a data file, InnoDB cannot know
the encryption status of the data file. The statement
SET GLOBAL innodb_encrypt_tables will have the side effect that
all not-yet-read InnoDB data files will be accessed in order to
determine the encryption status.

innodb_encrypt_tables_validate(): Stop disallowing
SET GLOBAL innodb_encrypt_tables when innodb_encryption_rotate_key_age=0.
This reverts part of commit 50eb40a2a8
that addressed MDEV-11738 and MDEV-11581.

fil_system_t::read_page0(): Trigger a call to fil_node_t::read_page0().
Refactored from fil_space_get_space().

fil_crypt_rotation_list_fill(): If innodb_encryption_rotate_key_age=0,
initialize fil_system->rotation_list. This is invoked both on
SET GLOBAL innodb_encrypt_tables and
on SET GLOBAL innodb_encryption_rotate_key_age=0.

fil_space_set_crypt_data(): Remove.

fil_parse_write_crypt_data(): Simplify the logic.

This is joint work with Marko Mäkelä.
2019-05-02 13:31:59 +03:00
Varun Gupta
ca94ce2a58 MDEV-19352: Server crash in alloc_histograms_for_table_share upon query from information schema
To read histograms for a table, we should check if the allocation of statistics was done or not,
if not done we should not try to read histograms for such a table.
2019-05-02 01:02:56 +05:30
Anel Husakovic
2370eeb028 MDEV-17654 Incorrect syntax returned for column with CHECK constraint in the "SHOW CREATE TABLE ..." result
Prepend COMMENT before CHECK constraint in SHOW CREATE

Closes #924
2019-05-01 19:52:27 +02:00
Aleksey Midenkov
aba9115426 MDEV-19349 mysql_install_db: segfault at tmp_file_prefix check 2019-05-01 10:15:29 +02:00
Elena Stepanova
e9da78ee92 Updated list of unstable tests for 10.1.39 release 2019-04-30 23:58:14 +03:00
Nikita Malyavin
dabef66e66 MDEV-19188 Server Crash When Using a Trigger With A Number of Virtual Columns on INSERT/UPDATE
use s->fields instead of s->stored_fields. extra_null_bitmap is allocated in Table_triggers_list::prepare_record_accessors with respect to virtual fields, so it will not overflow

Closes #1292
2019-04-30 19:48:07 +02:00
Oleksandr Byelkin
5b035c8456 MDEV-14572: Assertion `! is_set()' failed in Diagnostics_area::set_eof_status upon EXPLAIN UPDATE in PS
Restore EXPAIN flag in SELECT_LEX before execution multi-update by flag in LEX
(the same but in other way made before INSERT/DELETE/SELECT)

Without it, mysql_update() didn't know that there will be EXPLAIN result set and was sending OK at the end of the update, which conflicted with the EOF sent later by EXPLAIN.
2019-04-30 11:38:41 +02:00
Alexander Barkov
ba9f8776c2 Tests for MDEV-19359 ASAN heap-use-after-free in copy_if_not_alloced / make_sortkey
The patch for MDEV-18738 fixed this problem. Adding tests only.
2019-04-30 11:10:53 +04:00
Alexander Barkov
5fb6444a37 MDEV-18738 ASAN heap-use-after-free in copy_if_not_alloced / copy_fields
copy_if_not_alloced() did not handle situations when
"from" is a constant string pointing to a substring of "to",
so this code part freed "to" but then tried to copy its old (already freed)
content to a new buffer:

  if (to->realloc(from_length))
    return from;
  if ((to->str_length=MY_MIN(from->str_length,from_length)))
    memcpy(to->Ptr,from->Ptr,to->str_length);

Adding a new code piece that catches such constant substrings
and propery reallocs "to" to preserve its important part referenced
by "from".
2019-04-30 10:53:59 +04:00