Commit graph

8881 commits

Author SHA1 Message Date
Jan Lindström
93326ef051 MDEV-9663: InnoDB assertion failure: *cursor->index->name == TEMP_INDEX_PREFIX
MariaDB adjustments to test case innodb-replace-debug.

MariaDB 10.0 does not seem to be affected.
2017-11-16 13:21:07 +02:00
Jan Lindström
923ea5dbf6 MDEV-9663: InnoDB assertion failure: *cursor->index->name == TEMP_INDEX_PREFIX
Imported missing test case from MySQL 5.7 for

commit 25781c154396dbbc21023786aa3be070057d6999
Author: Annamalai Gurusami <annamalai.gurusami@oracle.com>
Date:   Mon Feb 24 14:00:03 2014 +0530

    Bug #17604730 ASSERTION: *CURSOR->INDEX->NAME == TEMP_INDEX_PREFIX
2017-11-16 13:18:22 +02:00
Marko Mäkelä
6a524fcfdd MDEV-14140 IMPORT TABLESPACE must not go beyond FSP_FREE_LIMIT
ibuf_check_bitmap_on_import(): Only access the pages that
are below FSP_FREE_LIMIT. It is possible that especially with
ROW_FORMAT=COMPRESSED, the FSP_SIZE will be much bigger than
the FSP_FREE_LIMIT, and the bitmap pages (page_size*N, 1+page_size*N)
are filled with zero bytes.

buf_page_is_corrupted(), buf_page_io_complete(): Make the
fault injection compatible with MariaDB 10.2.

Backport the IMPORT tests from 10.2.
2017-11-06 14:55:34 +02:00
Elena Stepanova
bfde65c0ae MDEV-10651, MDEV-14196 sys_vars.innodb_buffer_pool_* tests fail
- innodb_buffer_pool_dump_now_basic is modified to make sure it
  really performs a dump and waits till it completion, to avoid
  the apparent or hidden failure similar to MDEV-9713 / MDEV-10651
- innodb_buffer_pool_dump_pct_basic is modified to re-use the new
  code from innodb_buffer_pool_dump_now_basic and thus avoid
  the failure MDEV-10651
- innodb_buffer_pool_load_now_basic is re-written to simplify
  the logic by re-using the code innodb_buffer_pool_dump_now_basic
  and is given an opt file to avoid race conditions with
  buffer pool load performed upon server startup, which causes
  MDEV-14196 failure
2017-11-05 20:34:03 +02:00
Alexey Botchkov
1394ea6965 MDEV-13921 Audit log writes invalid SQL if single-line comments are
present.

        thread_pool_server_audit.test fixed.
        plugin version updated.
2017-11-03 22:40:44 +04:00
Alexey Botchkov
04daf30e9b MDEV-13921 Audit log writes invalid SQL if single-line comments are
present.

        Escape special characters (like \r \n \t) instead of
        replacing them with spaces.
2017-11-03 17:10:36 +04: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
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
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
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
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
Alexander Barkov
e30b6a983f MDEV-11819 NO_ZERO_IN_DATE: Incorrect generated column value 2017-10-06 18:23:40 +04: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
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
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ä
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
Marko Mäkelä
b8b3ba632b MDEV-13606 XA PREPARE transactions should survive innodb_force_recovery=1 or 2
When MySQL 5.0.3 introduced InnoDB support for two-phase commit,
it also introduced the questionable logic to roll back XA PREPARE
transactions on startup when innodb_force_recovery is 1 or 2.

Remove this logic in order to avoid unwanted side effects when
innodb_force_recovery is being set for other reasons. That is,
XA PREPARE transactions will always remain in that state until
InnoDB receives an explicit XA ROLLBACK or XA COMMIT request
from the upper layer.

At the time the logic was introduced in MySQL 5.0.3, there already
was a startup parameter that is the preferred way of achieving
the behaviour: --tc-heuristic-recover=ROLLBACK.
2017-08-23 13:03:13 +03:00
Elena Stepanova
31f4df4505 MDEV-12915 ST_Centroid does not return the same result than MySQL
Fix storage_engine test results
2017-08-01 09:52:59 +02:00
Vicențiu Ciorbaru
3772516391 Update innodb test result post print_lock_error change 2017-08-01 09:52:58 +02:00
Alexey Botchkov
7f5a8f176a MDEV-12915 ST_Centroid does not return the same result than MySQL.
Calculation of the polygon's centroid fixed.
2017-08-01 09:52:56 +02:00
Sergei Golubchik
496cea45e2 update error messages for 10.0 2017-07-27 12:42:40 +02:00
Vicențiu Ciorbaru
786ad0a158 Merge remote-tracking branch 'origin/5.5' into 10.0 2017-07-25 00:41:54 +03:00
Sergei Golubchik
9a5fe1f4ea Merge remote-tracking branch 'mysql/5.5' into 5.5 2017-07-18 14:59:10 +02:00
Alexander Barkov
d023156782 MDEV-8692 prefschema test failures on ARM (on Debian build system)
A few tests assumes that the CYCLE timer is always available,
which is not true on some platforms (e.g. ARM).
Fixing the tests not to reply on the CYCLE availability.
2017-07-17 12:34:58 +02:00
Daniel Black
2f07709aed MDEV-12436: binlog.binlog_unsafe - assumed len(hostname) <= 50 (#385)
Increased size in tests to allow for 100 character hostname.

Signed-off-by: Daniel Black <daniel.black@au.ibm.com>
2017-07-15 19:45:37 +03:00
Sergei Golubchik
89dc445a55 Merge branch '5.5' into 10.0 2017-07-06 23:47:33 +02:00
Sergei Golubchik
f305a7ce4b bugfix: long partition names 2017-07-06 19:09:47 +02:00
Andrei Elkin
946a07e8a8 Fix for MDEV-9670 server_id mysteriously set to 0
Problem was that in a circular replication setup the master remembers
position to events it has generated itself when reading from a slave.
If there are no new events in the queue from the slave, a
Gtid_list_log_event is generated to remember the last skipped event.
The problem happens if there is a network delay and we generate a
Gtid_list_log_event in the middle of the transaction, in which case there
will be an implicit comment and a new transaction with serverid=0 will be
logged.

The fix was to not generate any Gtid_list_log_events in the middle of a
transaction.
2017-07-02 19:47:30 +03:00
Vicențiu Ciorbaru
8baf9b0c46 Merge remote-tracking branch '5.5' into 10.0 2017-06-20 12:31:17 +03:00
Marko Mäkelä
5e4f4ec821 MDEV-12975 InnoDB redo log minimum size check uses detected file size instead of requested innodb_log_file_size
log_calc_max_ages(): Use the requested size in the check, instead of
the detected redo log size. The redo log will be resized at startup
if it differs from what has been requested.
2017-06-19 15:59:19 +03:00
Vicențiu Ciorbaru
f0ad93403f MDEV-12666: CURRENT_ROLE() and DATABASE() does not work in a view
The problem lies in how CURRENT_ROLE is defined. The
Item_func_current_role inherits from Item_func_sysconst, which defines
a safe_charset_converter to be a const_charset_converter.

During view creation, if there is no role previously set, the current_role()
function returns NULL.

This is captured on item instantiation and the
const_charset_converter call subsequently returns an Item_null.
In turn, the function is replaced with Item_null and the view is
then created with an Item_null instead of Item_func_current_role.

Without this patch, the first SHOW CREATE VIEW from the testcase would
have a where clause of WHERE role_name = NULL, while the second SHOW
CREATE VIEW would show a correctly created view.

The same applies for the DATABASE function, as it can change as well.

There is an additional problem with CURRENT_ROLE() when used in a
prepared statement. During prepared statement creation we used to set
the string_value of the function to the current role as well as the
null_value flag. During execution, if CURRENT_ROLE was not null, the
null_value flag was never set to not-null during fix_fields.

Item_func_current_user however can never be NULL so it did not show this
problem in a view before. At the same time, the CURRENT_USER() can not
be changed between prepared statement execution and creation so the
implementation where the value is stored during fix_fields is
sufficient.

Note also that DATABASE() function behaves differently during prepared
statements. See bug 25843 for details or commit
7e0ad09edf
2017-06-15 19:20:35 +03:00
Vicențiu Ciorbaru
34da3be8a8 MDEV-10463: Granted as a whole to roles, databases are not show in SHOW DATABASES
The problem lies in not checking role privileges as well during SHOW
DATABASES command. This problem is also apparent for SHOW CREATE
DATABASE command.

Other SHOW COMMANDS make use of check_access, which in turn makes use of
acl_get for both priv_user and priv_role parts, which allows them to
function correctly.
2017-06-15 19:20:35 +03:00
Sergei Golubchik
c661b4d0fb MDEV-13017 LOCK TABLE fails with irrelevant error while working with tables affected by ANSI_QUOTES 2017-06-14 13:22:37 +02:00
Marko Mäkelä
1d5a306e38 MDEV-12873 InnoDB SYS_TABLES.TYPE incompatibility for PAGE_COMPRESSION in MariaDB 10.2.2 to 10.2.6
Add a test case for corrupting SYS_TABLES.TYPE,
and for ROW_FORMAT=REDUNDANT, the unused field SYS_TABLES.MIX_LEN
that must be ignored (InnoDB before MySQL 5.5 wrote uninitialized
garbage to this column).

MariaDB 10.0 appears to validate the SYS_TABLES.TYPE properly.
This is a test-only change.
2017-06-13 17:20:38 +03:00
Vladislav Vaintroub
74e4cf70d0 MDEV-13059 XtraDB hangs on Windows due to failing to release block->lock X-latch
in innodb_read_only mode.

The reason for the hang is that there was no notification received about
completed read io. File handles are bound to completion_port, and there
were no background "write" threads that would be waiting on completion_port,
only 2 "read" threads waiting on read_completion_port were active.

The fix is to use a single IO completion port for all IOs, if
innodb_read_only is set.
2017-06-12 18:43:23 +00:00
Marko Mäkelä
75b35a3b68 Partially disable a test affected by MDEV-13059 2017-06-12 14:10:39 +03:00
Marko Mäkelä
4325041df6 MDEV-13057 innodb_read_only=1 should avoid creating buf_flush_page_cleaner_thread
When the server is started in innodb_read_only mode, there cannot be
any writes to persistent InnoDB/XtraDB files. Just like the creation
of buf_flush_page_cleaner_thread is skipped in this case, also
the creation of the XtraDB-specific buf_flush_lru_manager_thread
should be skipped.
2017-06-12 11:08:06 +03:00
Marko Mäkelä
417434f12d MDEV-13039 innodb_fast_shutdown=0 may fail to purge all undo log
When a slow shutdown is performed soon after spawning some work for
background threads that can create or commit transactions, it is possible
that new transactions are started or committed after the purge has finished.
This is violating the specification of innodb_fast_shutdown=0, namely that
the purge must be completed. (None of the history of the recent transactions
would be purged.)

Also, it is possible that the purge threads would exit in slow shutdown
while there exist active transactions, such as recovered incomplete
transactions that are being rolled back. Thus, the slow shutdown could
fail to purge some undo log that becomes purgeable after the transaction
commit or rollback.

srv_undo_sources: A flag that indicates if undo log can be generated
or the persistent, whether by background threads or by user SQL.
Even when this flag is clear, active transactions that already exist
in the system may be committed or rolled back.

innodb_shutdown(): Renamed from innobase_shutdown_for_mysql().
Do not return an error code; the operation never fails.
Clear the srv_undo_sources flag, and also ensure that the background
DROP TABLE queue is empty.

srv_purge_should_exit(): Do not allow the purge to exit if
srv_undo_sources are active or the background DROP TABLE queue is not
empty, or in slow shutdown, if any active transactions exist
(and are being rolled back).

srv_purge_coordinator_thread(): Remove some previous workarounds
for this bug.

innobase_start_or_create_for_mysql(): Set buf_page_cleaner_is_active
and srv_dict_stats_thread_active directly. Set srv_undo_sources before
starting the purge subsystem, to prevent immediate shutdown of the purge.
Create dict_stats_thread and fts_optimize_thread immediately
after setting srv_undo_sources, so that shutdown can use this flag to
determine if these subsystems were started.

dict_stats_shutdown(): Shut down dict_stats_thread. Backported from 10.2.

srv_shutdown_table_bg_threads(): Remove (unused).
2017-06-09 16:20:42 +03:00
Marko Mäkelä
d8d39721df Follow-up to MDEV-12042 (test innodb_page_size variants)
innodb_page_size_small: A new set of combinations, for
innodb_page_size up to 16k. In MariaDB 10.0, this does not
make a difference, but in 10.1 and later, innodb_page_size
would cover 32k and 64k, for which ROW_FORMAT=COMPRESSED
is not available.

Enable these combinations in a few InnoDB tests.
2017-06-06 09:34:09 +03:00
Marko Mäkelä
449a88e1c6 MDEV-12052 Shutdown crash presumably due to master thread activity
InnoDB shutdown assumes that once the server has entered
SRV_SHUTDOWN_FLUSH_PHASE, no change to persistent data is allowed.
It was possible for the master thread to wake up while shutdown
is executing in SRV_SHUTDOWN_FLUSH_PHASE or
even in SRV_SHUTDOWN_LAST_PHASE.

We do not yet know if further crashes at shutdown are possible.
Also, we do not know if all the observed crashes could be explained
by the race conditions that we are now fixing.

srv_shutdown_print_master_pending(): Remove a redundant ut_time() call.

srv_shutdown(): Renamed from srv_master_do_shutdown_tasks().

srv_master_thread(): Do not resume after shutdown has been initiated.
2017-05-26 15:08:35 +03:00