Commit graph

65467 commits

Author SHA1 Message Date
Jan Lindström
6d783b6a76 MW-388
MariaDB adjustments.
2017-11-08 14:15:54 +02:00
sjaakola
f4f2e8fa2a MW-402 cascading FK issues
* created tests focusing in multi-master conflicts during cascading foreign key
  processing
* in row0upd.cc, calling wsrep_row_ups_check_foreign_constraints only when
  running in cluster
* in row0ins.cc fixed regression from MW-369, which caused crash with MW-402.test
2017-11-08 14:15:41 +02:00
Daniele Sciascia
76f1195f5b MW-388 Fix conflict handling of SPs with DECLARE ... HANDLER
It is possible for a stored procedure that has an error handler
that catches SQLEXCEPTION to call thd->clear_error() on a thd
that failed certification. And because the error is cleared,
wsrep patch proceeds with the normal path and may try to commit
statements that should actually abort.
This patch catches the situation where wsrep_conflict_state is
still set, but the thd's error has been cleared, and rolls back
the statement in such cases.
2017-11-08 12:21:51 +02:00
Sachin Setiya
3cecb1bab3 Merge tag 'mariadb-10.0.33' into bb-10.0-galera 2017-11-03 12:34:05 +05:30
Elena Stepanova
c3592ca7b8 List of unstable tests for 10.0.33 release 2017-10-27 03:19:59 +03:00
Marko Mäkelä
44ed243522 Merge 5.5 into 10.0 2017-10-24 19:25:19 +03:00
Marko Mäkelä
439a7c994a MDEV-14051 'Undo log record is too big.' error occurring in very narrow range of string lengths
InnoDB was writing unnecessary information to the
update undo log records. Most notably, if an indexed column is updated,
the old value of the column would be logged twice: first as part of
the update vector, and then another time because it is an indexed column.

Because the InnoDB undo log record must fit in a single page,
this would cause unnecessary failure of certain updates.

Even after this fix, InnoDB still seems to be unnecessarily logging
indexed column values for non-updated columns. It seems that non-updated
secondary index columns only need to be logged when a PRIMARY KEY
column is updated. To reduce risk, we are not fixing this remaining flaw
in GA versions.

trx_undo_page_report_modify(): Log updated indexed columns only once.
2017-10-24 17:00:04 +03:00
Igor Babaev
a1a79aa576 MDEV-13776 mysqld got signal 11 on delete returning
The method Field_iterator_table::create_item() must take into
account that it can be called when processing DELETE RETURNING.
2017-10-23 15:35:10 -07:00
Igor Babaev
acb336f75e MDEV-13607 MariaDB crash in fix_semijoin_strategies_for_picked_join_order
An overflow of the double variable storing the estimate of the
number of rows in a partial join could trigger an assertion
failure during the optimization stage.
2017-10-23 15:33:13 -07:00
Sergei Golubchik
da4503e956 Merge branch '5.5' into 10.0 2017-10-18 15:14:39 +02:00
Marko Mäkelä
30e89acd95 Import, adapt and extend a test from Oracle 2017-10-18 10:06:48 +03:00
Marko Mäkelä
9817479563 Add a test of LIMIT with FULLTEXT INDEX
In MariaDB, InnoDB fulltext search does not currently
truncate results based on LIMIT. In MySQL 5.7, it does.
2017-10-18 08:25:04 +03:00
Marko Mäkelä
dfd010ef90 MDEV-14086 Setting innodb_buffer_pool_load_now or innodb_buffer_load_abort will crash if innodb_read_only
When MySQL 5.6.10 introduced innodb_read_only mode, it skipped the
creation of the InnoDB buffer pool dump/restore subsystem in that mode.
Attempts to set the variable innodb_buf_pool_dump_now would have
no effect in innodb_read_only mode, but the corresponding condition
was forgotten in from the other two update functions.

MySQL 5.7.20 would fix the innodb_buffer_pool_load_now,
but not innodb_buffer_pool_load_abort. Let us fix both in MariaDB.
2017-10-18 06:35:11 +03:00
Sergei Golubchik
b000e16956 Bug#26361149 MYSQL SERVER CRASHES AT: COL IN(IFNULL(CONST, COL), NAME_CONST('NAME', NULL))
based on:

commit f7316aa0c9
Author: Ajo Robert <ajo.robert@oracle.com>
Date:   Thu Aug 24 17:03:21 2017 +0530

    Bug#26361149  MYSQL SERVER CRASHES AT: COL IN(IFNULL(CONST,
                           COL), NAME_CONST('NAME', NULL))

    Backport of Bug#19143243 fix.

    NAME_CONST item can return NULL_ITEM type in case of incorrect arguments.
    NULL_ITEM has special processing in Item_func_in function.
    In Item_func_in::fix_length_and_dec an array of possible comparators is
    created. Since NAME_CONST function has NULL_ITEM type, corresponding
    array element is empty. Then NAME_CONST is wrapped to ITEM_CACHE.
    ITEM_CACHE can not return proper type(NULL_ITEM) in Item_func_in::val_int(),
    so the NULL_ITEM is attempted compared with an empty comparator.
    The fix is to disable the caching of Item_name_const item.
2017-10-17 11:04:09 +02:00
Sergei Golubchik
df5f25fa7a Merge branch 'mysql/5.5' into 5.5 2017-10-17 10:18:17 +02:00
Sergei Golubchik
b036b6b594 MDEV-13937 Aria engine: Internal Error 160 after partition handling
Partition wasn't setting HA_OPTION_PACK_RECORD on ALTER TABLE
if the row format was PAGE.

(so one bit in the null bitmap was reserved for a deleted bit -
see make_empty_rec - and all actual null bits were one off)
2017-10-17 07:37:39 +02:00
Sergei Golubchik
19a702a85c MDEV-14056 DROP TEMPORARY TABLE IF EXISTS causes error 1290 with read_only option
if it's a DROP TABLE, we cannot detect whether a table is
temporary by looking in thd->temporary_tables - because the
table might simply not exist at all.
2017-10-17 07:37:39 +02:00
Sergei Golubchik
421716391b MDEV-13912 Can't refer the same column twice in one ALTER TABLE
backport ce6c0e584e

MDEV-8960: Can't refer the same column twice in one ALTER TABLE

Problem was that if column was created in alter table when
it was refered again it was not tried to find from list
of current columns.

mysql_prepare_alter_table:
  There is two cases
    (1) If alter table adds a new column and then later alter
        changes the field definition, there was no check from
	list of new columns, instead an incorrect error was given.
    (2) If alter table adds a new column and then later alter
        changes the default, there was no check from list of
	new columns, instead an incorrect error was given.
2017-10-17 07:37:39 +02:00
Marko Mäkelä
9a791c9c8d MDEV-12676 MySQL#78423 InnoDB FTS duplicate key error
fts_get_next_doc_id(): Assign the first and subsequent FTS_DOC_ID
in the same way: by post-incrementing the cached value.
If there is a user-specified FTS_DOC_ID, do not touch the internal
sequence.
2017-10-16 19:11:30 +03:00
Marko Mäkelä
1eee3a3fb7 MDEV-13051 MySQL#86607 InnoDB crash after failed ADD INDEX and table_definition_cache eviction
There are two bugs related to failed ADD INDEX and
the InnoDB table cache eviction.

dict_table_close(): Try dropping failed ADD INDEX when releasing
the last table handle, not when releasing the last-but-one.

dict_table_remove_from_cache_low(): Do not invoke
row_merge_drop_indexes() after freeing all index metadata.
Instead, directly invoke row_merge_drop_indexes_dict() to
remove the metadata from the persistent data dictionary
and to free the index pages.
2017-10-16 19:11:30 +03:00
Oleksandr Byelkin
235b68299b MDEV-9619: Assertion `null_ref_table' failed in virtual table_map Item_direct_view_ref::used_tables() const on 2nd execution of PS
Refer left expression indirectly in case it changes from execution to execution.
2017-10-13 19:32:38 +02:00
Igor Babaev
2bab29ebba Fixed the bug mdev-13135.
For each SELECT the list sj_nests is built by the
function simplify_joins() when scanning different
join nests. This function may be called several
times for the same join nest. That's why before
adding a new member to sj_nests it is necessary
to check if it's already in the list.
The code of simplify_joins() lacked this check and
as a result it could cause memory overwright for
some queries.
2017-10-13 07:24:54 -07:00
Oleksandr Byelkin
a4868c3509 MDEV-9208: Function->Function->View = Mysqld segfault (Server crashes in Dependency_marker::visit_field on 2nd execution with merged subquery)
Prevent crossing name resolution border in finding item tables.
2017-10-13 12:35:17 +02:00
Alexander Barkov
991b9ee735 MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535 2017-10-13 07:06:09 +04:00
Vicențiu Ciorbaru
b9418ed333 MDEV-13676: Field "create Procedure" is NULL, even if the the user has role which is the definer. (SHOW CREATE PROCEDURE)
During show create procedure we ommited to check the current role, if it
is the actual definer of the procedure. In addition, we should support
indirectly granted roles to the current role. Implemented a recursive
lookup to search the tree of grants if the rolename is present.

SQL Standard 2016, Part 5 Section 53 View I_S.ROUTINES selects
ROUTINE_BODY and its WHERE clause says that the GRANTEE must be
either PUBLIC, or CURRENT_USER or in the ENABLED_ROLES.
2017-10-11 12:15:52 +03:00
Jan Lindström
fc9ff69578 MDEV-13838: Wrong result after altering a partitioned table
Reverted incorrect changes done on MDEV-7367 and MDEV-9469. Fixes properly
also related bugs:

MDEV-13668: InnoDB unnecessarily rebuilds table when renaming a column and adding index
MDEV-9469: 'Incorrect key file' on ALTER TABLE
MDEV-9548: Alter table (renaming and adding index) fails with "Incorrect key file for table"
MDEV-10535: ALTER TABLE causes standalone/wsrep cluster crash
MDEV-13640: ALTER TABLE CHANGE and ADD INDEX on auto_increment column fails with "Incorrect key file for table..."

Root cause for all these bugs is the fact that MariaDB .frm file
can contain virtual columns but InnoDB dictionary does not and
previous fixes were incorrect or unnecessarily forced table
rebuilt. In index creation key_part->fieldnr can be bigger than
number of columns in InnoDB data dictionary. We need to skip not
stored fields when calculating correct column number for InnoDB
data dictionary.

dict_table_get_col_name_for_mysql
        Remove

innobase_match_index_columns
        Revert incorrect change done on MDEV-7367

innobase_need_rebuild
        Remove unnecessary rebuild force when column is renamed.

innobase_create_index_field_def
        Calculate InnoDB column number correctly and remove
        unnecessary column name set.

innobase_create_index_def, innobase_create_key_defs
        Remove unneeded fields parameter. Revert unneeded memset.

prepare_inplace_alter_table_dict
        Remove unneeded col_names parameter

index_field_t
        Remove unneeded col_name member.

row_merge_create_index
        Remove unneeded col_names parameter and resolution.

Effected tests:
         innodb-alter-table : Add test case for MDEV-13668
         innodb-alter : Remove MDEV-13668, MDEV-9469 FIXMEs
                        and restore original tests
         innodb-wl5980-alter : Remove MDEV-13668,  MDEV-9469 FIXMEs
                        and restore original tests
2017-10-10 17:03:40 +03:00
Vesa Pentti
93aadda513 MDEV-13149 -- show function status now works with PAD_CHAR_TO_FULL_LENGTH 2017-10-10 16:16:12 +03:00
Sergei Golubchik
2db5e4d1f9 smaller stack size on quantal-x86 and wheezy-x86
fixes failures of func_regexp_pcre
2017-10-10 14:31:33 +02:00
Alexander Barkov
c2509a1588 MDEV-13972 crash in Item_func_sec_to_time::get_date 2017-10-10 10:35:12 +04:00
Sergei Golubchik
440157cbbe MDEV-13412 main.func_regexp_pcre fails in buildbot on ppc64le
Caused by 2fcd8c1252. It used the documented pcre API

 -pcre_exec(NULL, NULL, NULL, -999, -999, 0, NULL, 0)

to calculate the pcre stack frame size. Unfortunately, modern compilers
broke it by cloning and inlining pcre match() function. 2fcd8c1252
tried to workaround it by setting the stack frame size to at least 500.
It didn't work, 500 is not a universal constant.

Now we fix our copy of pcre to not inline or clone match() - so that
stack frame detection would work again - and detect at cmake time
whether system pcre is broken or usable.

Also use stack, not (much slower) malloc in bundled pcre, unless on Windows
2017-10-09 17:51:34 +02:00
Elena Stepanova
bc85d22bf0 MDEV-12263 Feature: skipped test file
Post-fix: RedHat does not use rh-skipped-tests.list anymore
2017-10-09 02:49:50 +03:00
Elena Stepanova
9b897d663a MDEV-12263 Feature: skipped test file
A note about unstable-tests lists in mysql-test/README, RedHat
version of it, and also various changes to bring the file
up-to-date
2017-10-09 01:43:31 +03:00
Alexander Barkov
ca948e335e MDEV-9886 Illegal mix of collations with a view comparing a field to a binary constant 2017-10-07 13:42:11 +04:00
Alexander Barkov
e30b6a983f MDEV-11819 NO_ZERO_IN_DATE: Incorrect generated column value 2017-10-06 18:23:40 +04:00
Igor Babaev
dbeffabc83 Fixed the bug mdev-11574.
Do not build an index merge of two indexes when one index is
an infix of the other index.
2017-10-06 00:08:36 -07:00
Marko Mäkelä
19d21b9366 Cherry-pick the MDEV-13898 test changes from 10.2 to 10.0 2017-09-25 09:34:15 +03:00
Sergei Golubchik
8d0448d507 MDEV-13861 Assertion `0' failed in Protocol::end_statement
followup for 378beed0a6 - only count WARN_LEVEL_ERROR,
not warnings or notes.
2017-09-21 21:43:07 +02:00
Marko Mäkelä
db7fd021fe Add have_debug.inc to skip the test faster in non-debug builds 2017-09-21 12:31:30 +03:00
Sergei Golubchik
b7434bacbd include/master-slave.inc must always be included last 2017-09-20 18:17:50 +02:00
Vicențiu Ciorbaru
20d4cac6db Merge branch 'bb-10.0-vicentiu' into 10.0 2017-09-20 10:24:31 +03:00
Oleksandr Byelkin
97c2a7354b MDEV-13290: Assertion Assertion !is_set() || (m_status == DA_OK_BULK && is_bulk_op())' or ! is_set()' failed
Check error status which can be set by conversion procedures.
2017-09-19 16:19:06 +02:00
Vicențiu Ciorbaru
d6a7de2022 Merge branch '5.5' into 10.0 2017-09-19 01:02:01 +03:00
Vladislav Vaintroub
a870099817 Windows : support vsjitdebugger in MTR's --debugger. 2017-09-15 16:20:38 +00:00
Alexander Barkov
434e283507 MDEV-13685 Can not replay binary log due to Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation 'concat' 2017-09-15 12:25:06 +04:00
Marko Mäkelä
ee844f6c34 Make the SEARCH_ABORT logic actually work
The SEARCH_ABORT logic was not working as intended
(tests were not being aborted).
2017-09-07 11:59:26 +03:00
Andrei Elkin
641baa5d03 Post-push for MDEV-13437
A new $MYSQLD_LAST_CMD evaluation was too late in case --manual-gdb.
Now it is done before the server restart type branches which is safe
and the args value has been fully computed by the new point of
evaluation.
2017-09-04 18:42:30 +03:00
Marko Mäkelä
9e9a3b8ede Merge innodb.create-index test changes from MySQL 5.6 to MariaDB
Import the MySQL 5.6 addition from innodb.create-index to a new debug-only
test, innodb.create-index-debug. The existing test innodb.create-index
also runs on a debug server.
2017-08-29 18:35:30 +03:00
Marko Mäkelä
f56bd70f51 Adjust the imported MySQL 5.6 tests for MariaDB
FIXME: MDEV-13668 InnoDB unnecessarily rebuilds table

FIXME: MDEV-13671 InnoDB should use case-insensitive column name comparisons
like the rest of the server

FIXME: MDEV-13640 / Properly fix MDEV-9469 'Incorrect key file' on ALTER TABLE

FIXME: investigate result difference in innodb.innodb-alter-autoinc
and ensure that MariaDB does the right thing with auto_increment_increment
and auto_increment_offset, for both ALGORITHM=INPLACE and ALGORITHM=COPY
(Oracle MySQL behaviour differs between those two).
2017-08-29 18:33:30 +03:00
Marko Mäkelä
8d9298167e MDEV-13625 Merge InnoDB test cases from MySQL 5.6 (part 1)
Import some ALTER TABLE test cases from MySQL 5.6 without modification.
The adjustments will be in a separate commit.
2017-08-29 15:28:58 +03:00
Andrei Elkin
888a8b69bd MDEV-13437 InnoDB fails to return error for XA COMMIT or XA ROLLBACK in read-only mode
Assertions failed due to incorrect handling of the --tc-heuristic-recover
option when InnoDB is in read-only mode either due to innodb_read_only=1
or innodb_force_recovery>3. InnoDB failed to refuse a XA COMMIT or
XA ROLLBACK operation, and there were errors in the error handling in
the upper layer.

This was fixed by making InnoDB XA operations respect the
high_level_read_only flag. The InnoDB part of the fix and
parts of the test main.tc_heuristic_recover were provided
by Marko Mäkelä.

LOCK_log mutex lock/unlock had to be added to fix MDEV-13438.
The measure is confirmed by mysql sources as well.

For testing of the conflicting option combination, mysql-test-run is
made to export a new $MYSQLD_LAST_CMD. It holds the very last value
generated by mtr.mysqld_start().  Even though the options have been
also always stored in $mysqld->{'started_opts'} there were no access
to them beyond the automatic server restart by mtr through the expect
file interface.

Effectively therefore $MYSQLD_LAST_CMD represents a more general
interface to $mysqld->{'started_opts'} which can be used in wider
scopes including server launch with incompatible options.

Notice another existing method to restart the server with incompatible
options relying on $MYSQLD_CMD is is aware of $mysqld->{'started_opts'}
(the actual options that the server is launched by mtr). In order to use
this method they would have to be provided manually.

NOTE: When merging to 10.2, the file search_pattern_in_file++.inc
should be replaced with the pre-existing search_pattern_in_file.inc.
2017-08-29 11:59:59 +03:00