Commit graph

67925 commits

Author SHA1 Message Date
Igor Babaev
5e4aa1a2f8 Fixed the bug mdev-13709.
Currently condition pushdown into materialized views / derived tables
is not implemented yet (see mdev-12387) and grouping views are
optimized early when subqueries are converted to semi-joins in
convert_join_subqueries_to_semijoins(). If a subquery that is converted
to a semi-join uses a grouping view this view is optimized in two phases.
For such a view V only the first phase of optimization is done after
the conversion of subqueries of the outer join into semi-joins.
At the same time the reference of the view V appears in the join
expression of the outer join. In fixed code there was an attempt to push
conditions into this view and to optimize it after this. This triggered
the second phase of the optimization of the view and it was done
prematurely. The second phase of the optimization for the materialized
view is supposed to be called after the splitting condition is pushed
into the view in the call of JOIN::improve_chosen_plan for the outer
join.

The fix blocks the attempt to push conditions into splittable views
if they have been already partly optimized and the following
optimization for them.

The test case of the patch shows that the code for mdev-13369
basically supported the splitting technique for materialized views /
derived tables.

The patch also replaces the name of the state JOIN::OPTIMIZATION_IN_STAGE_2
for JOIN::OPTIMIZATION_PHASE_1_DONE and fixes a bug in
TABLE_LIST::fetch_number_of_rows()
2017-09-08 11:27:02 -07:00
Marko Mäkelä
fb14761d66 Merge 10.2 into bb-10.2-ext 2017-09-08 15:44:34 +03:00
Marko Mäkelä
672590afaf Adjust the imported innodb.alter_crash test for MariaDB
trx_undo_assign_undo(): Restore the fault injection.
2017-09-08 15:34:42 +03:00
Marko Mäkelä
13d4dfd02c MDEV-13626 Merge InnoDB test cases from MySQL 5.7 (part 1)
Import the test innodb.alter_crash
2017-09-08 15:33:03 +03:00
Marko Mäkelä
95f602698a Make a test more robust
The redo log is divided into 512-byte blocks. Sometimes, some of
the strings end up at a block boundary and will not be found.
Look for only one match.
2017-09-08 09:38:42 +03:00
Vladislav Vaintroub
18e17f134c Windows : Fix MTR's misuse of servers --console parameter 2017-09-08 08:33:41 +02:00
Vladislav Vaintroub
d471469bd2 MDEV-13466 Implement --export option for MariaDB Backup
full server recovery is performed .
We start "mysqld" with  --bootstrap
and pass bootstrap script consisting of several FLUSH TABLES FOR export/
UNLOCK TABLES
2017-09-07 22:54:06 +00:00
Marko Mäkelä
a82ed92a6a Merge 10.2 into bb-10.2-ext 2017-09-07 12:23:58 +03:00
Marko Mäkelä
d26fb96a9f Merge 10.1 into 10.2 2017-09-07 12:12:31 +03:00
Marko Mäkelä
112d721a74 Merge 10.0 into 10.1 2017-09-07 12:08:34 +03: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
Marko Mäkelä
70db1e3b8a Merge 10.1 into 10.2 2017-09-06 19:28:51 +03:00
Marko Mäkelä
c59a52b7ba Fix nondeterministic failure of innodb.table_flags
The files ibtmp1 and ib_buffer_pool are sometimes created, sometimes not.
Remove them if they exist.
2017-09-06 19:10:12 +03:00
Oleksandr Byelkin
2b387855df MDEV-13523: Group By in a View, called within a Stored Routine causes Error Code 1356 when a non-root user runs the routine for a second time
it is actually test suite for second code chunk fix in MDEV-13439
2017-09-06 17:20:31 +02:00
Marko Mäkelä
7008d46164 Follow-up to MDEV-13227: Shorten the test
The bug only affects ROW_FORMAT=DYNAMIC tables.
It is reproducible already with 2 records in the table.

Keep testing with ROW_FORMAT=REDUNDANT just in case.
2017-09-06 16:13:20 +03:00
Marko Mäkelä
a793b7fd8b Follow-up to MDEV-13227: Do not run unnecessary test combinations
The bug only affected innodb_page_size=64k. There is no point
running the test with smaller page sizes.
2017-09-06 15:57:42 +03:00
Marko Mäkelä
cd694d76ce Merge 10.0 into 10.1 2017-09-06 15:32:56 +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
Oleksandr Byelkin
17589989ee MDEV-10972: Insert from select / view / union -- repeatable crash in 10.1, 10.2 Linux/Mac/Windows
save thd->select_number between parsing and executions (in case it was not complete executed due to errors (for example epsent table))
2017-09-04 16:45:02 +02:00
Marko Mäkelä
2f3968d98f After-merge fixes for Galera test results 2017-09-01 11:29:11 +03:00
Marko Mäkelä
05cc028f56 Merge 10.2 into bb-10.2-ext 2017-09-01 11:24:36 +03:00
Marko Mäkelä
b660584b10 After-merge fix for a Galera test result 2017-09-01 11:23:45 +03:00
Marko Mäkelä
6749d39a95 Merge 10.2 into bb-10.2-ext 2017-09-01 08:47:55 +03:00
Marko Mäkelä
1b41a54fc9 Fix test for MDEV-13674: Deprecate innodb_use_mtflush and innodb_mtflush_threads 2017-09-01 08:38:19 +03:00
Marko Mäkelä
a9e71c77e4 Disable a badly written, randomly failing Galera test
CURRENT_TEST: galera.galera_kill_applier
mysqltest: At line 14: query 'KILL $applier_thread' failed with wrong
errno 1064: 'You have an error in your SQL syntax; check the manual
that corresponds to your MariaDB server version for the right syntax
to use near '' at line 1', instead of 1095...
2017-08-31 14:35:35 +03:00
Jan Lindström
e23de9f2e0 MDEV-13674: Deprecate innodb_use_mtflush and innodb_mtflush_threads
These parameters and associated code is to be removed in 10.3.
Users can use innodb-page-cleaners > 1 instead.
2017-08-31 13:36:36 +03:00
Marko Mäkelä
2f20be946f Merge 10.1 into 10.2 2017-08-31 09:35:39 +03:00
Marko Mäkelä
03a8eaa072 Fix some badly written Galera tests
galera.galera_kill_applier: Make the test less likely to fail
by adding sleep time.

galera.query_cache: Remove data truncation.

Part of the test file looks like it has been misinterpreted as latin1
and wrongly converted to UTF-8 encoding. In MariaDB 10.1, the server would
only warn about data truncation and not issue an error. 10.2 is stricter.
(The test should be carefully reviewed if it really makes sense.)
2017-08-31 09:30:54 +03:00
Marko Mäkelä
a36c369bda Merge 10.1 into 10.2
For running the Galera tests, the variable my_disable_leak_check
was set to true in order to avoid assertions due to memory leaks
at shutdown.

Some adjustments due to MDEV-13625 (merge InnoDB tests from MySQL 5.6)
were performed. The most notable behaviour changes from 10.0 and 10.1
are the following:

* innodb.innodb-table-online: adjustments for the DROP COLUMN
behaviour change (MDEV-11114, MDEV-13613)

* innodb.innodb-index-online-fk: the removal of a (1,NULL) record
from the result; originally removed in MySQL 5.7 in the
Oracle Bug #16244691 fix
377774689b

* innodb.create-index-debug: disabled due to MDEV-13680
(the MySQL Bug #77497 fix was not merged from 5.6 to 5.7.10)

* innodb.innodb-alter-autoinc: MariaDB 10.2 behaves like MySQL 5.6/5.7,
while MariaDB 10.0 and 10.1 assign different values when
auto_increment_increment or auto_increment_offset are used.
Also MySQL 5.6/5.7 exhibit different behaviour between
LGORITHM=INPLACE and ALGORITHM=COPY, so something needs to be tested
and fixed in both MariaDB 10.0 and 10.2.

* innodb.innodb-wl5980-alter: disabled because it would trigger an
InnoDB assertion failure (MDEV-13668 may need additional effort in 10.2)
2017-08-31 09:30:40 +03:00
Jan Lindström
28b2896a43 Fixed test failure on innodb_encryption
After MDEV-13583: Improvements for MTR rebootstrap introduced in
MDEV-12042 bootsrap correctly creates mysql/innodb_table_stats
and mysql/innodb_index_stats InnoDB tables before innodb_encryption
test starts. These tables are also encrypted or decrypted, thus
we need to wait also these tables (if not we could randomly
get different results as system tablespace and these tables
are encrypted or decrypted in parallel).
2017-08-31 09:15:23 +03:00
Jan Lindström
eca238aea7 MDEV-13557: Startup failure, unable to decrypt ibdata1
Fixes also MDEV-13488: InnoDB writes CRYPT_INFO even though
encryption is not enabled.

Fixes also MDEV-13093: Leak of Datafile::m_crypt_info on
shutdown after failed startup.

Problem was that we created encryption metadata (crypt_data) for
system tablespace even when no encryption was enabled and too early.
System tablespace can be encrypted only using key rotation.

Test innodb-key-rotation-disable, innodb_encryption, innodb_lotoftables
require adjustment because INFORMATION_SCHEMA INNODB_TABLESPACES_ENCRYPTION
contain row only if tablespace really has encryption metadata.

xb_load_single_table_tablespace(): Do not call
fil_space_destroy_crypt_data() any more, because Datafile::m_crypt_data
has been removed.

fil_crypt_realloc_iops(): Avoid divide by zero.

fil_crypt_set_thread_cnt(): Set fil_crypt_threads_event if
encryption threads exist. This is required to find tablespaces
requiring key rotation if no other changes happen.

fil_crypt_find_space_to_rotate(): Decrease the amount of time waiting
when nothing happens to better enable key rotation on startup.

fil_ibd_open(), fil_ibd_load(): Load possible crypt_data from first
page.

class Datafile, class SysTablespace : remove m_crypt_info field.

Datafile::get_first_page(): Return a pointer to first page buffer.

fsp_header_init(): Write encryption metadata to page 0 only if
tablespace is encrypted or encryption is disabled by table option.

i_s_dict_fill_tablespaces_encryption(): Skip tablespaces that do not
contain encryption metadata. This is required to avoid too early
wait condition trigger in encrypted -> unencrypted state transfer.
2017-08-31 08:36:56 +03:00
Vladislav Vaintroub
91826970c5 Fix threadpool to report connections aborted due to wait timeout.
Update wait_timeout.test to add test case for this.
2017-08-30 14:37:16 +00:00
Marko Mäkelä
1831042279 Temporarily disable encryption.innodb_encryption after the merge 2017-08-30 16:55:45 +03:00
Marko Mäkelä
829752973b Merge branch '10.0' into 10.1 2017-08-30 13:06:13 +03:00
Jan Lindström
01209de763 Merge remote-tracking branch 'origin/bb-10.1-jplindst' into 10.1 2017-08-29 20:30:18 +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
Jan Lindström
352d27ce36 MDEV-13557: Startup failure, unable to decrypt ibdata1
Fixes also MDEV-13488: InnoDB writes CRYPT_INFO even though
encryption is not enabled.

Problem was that we created encryption metadata (crypt_data) for
system tablespace even when no encryption was enabled and too early.
System tablespace can be encrypted only using key rotation.

Test innodb-key-rotation-disable, innodb_encryption, innodb_lotoftables
require adjustment because INFORMATION_SCHEMA INNODB_TABLESPACES_ENCRYPTION
contain row only if tablespace really has encryption metadata.

fil_crypt_set_thread_cnt: Send message to background encryption threads
if they exits when they are ready. This is required to find tablespaces
requiring key rotation if no other changes happen.

fil_crypt_find_space_to_rotate: Decrease the amount of time waiting
when nothing happens to better enable key rotation on startup.

fsp_header_init: Write encryption metadata to page 0 only if tablespace is
encrypted or encryption is disabled by table option.

i_s_dict_fill_tablespaces_encryption : Skip tablespaces that do not
contain encryption metadata. This is required to avoid too early
wait condition trigger in encrypted -> unencrypted state transfer.

open_or_create_data_files: Do not create encryption metadata
by default to system tablespace.
2017-08-29 14:23:34 +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
Marko Mäkelä
f192b48d62 Merge 10.1 into 10.2 2017-08-29 10:07:33 +03:00
Vladislav Vaintroub
dda40b9304 AWS Key Management : Introduce "mock" variable, available in debug build.
If this variable is set, skip actual AWS calls, and fake/mock
both generation and encryption of the keys.

The advantage of having a mock mode is that more aws_key_management tests
can be enabled on buildbot.
2017-08-28 18:28:07 +00:00
Elena Stepanova
05e7d35e89 MDEV-13583 Improvements for MTR rebootstrap introduced in MDEV-12042
- make re-bootstrap run with all extra options, not only InnoDB ones
- re-use previously created bootstrap.sql
- add --console
- fix debian patch to keep it applicable
2017-08-28 19:49:02 +03:00
Elena Stepanova
71931fdf83 Fix results for parts/repair_table test after enabling it for MyISAM 2017-08-28 19:41:13 +03:00
Marko Mäkelä
11352d52cd Merge 10.0 into 10.1 2017-08-28 15:05:46 +03:00
Marko Mäkelä
309fe35f29 Correct a mtr.add_suppression() expression 2017-08-28 13:46:31 +03:00
Jan Lindström
bbfd53cd32 Add galera suite to default suites and disable failing test
cases.
2017-08-28 11:39:28 +03:00
Jan Lindström
61096ff214 MDEV-13591: InnoDB: Database page corruption on disk or a failed file read and assertion failure
Problem is that page 0 and its possible enrryption information
is not read for undo tablespaces.

fil_crypt_get_latest_key_version(): Do not send event to
encryption threads if event does not yet exists. Seen
on regression testing.

fil_read_first_page: Add new parameter does page belong to
undo tablespace and if it does, we do not read FSP_HEADER.

srv_undo_tablespace_open : Read first page of the tablespace
to get crypt_data if it exists and pass it to fil_space_create.

Tested using innodb_encryption with combinations with
innodb-undo-tablespaces.
2017-08-28 09:49:30 +03:00
Elena Stepanova
882f4566e5 Combinations with innodb-undo-tablespaces to use in test files 2017-08-28 09:49:30 +03:00
Sergei Golubchik
c02d61bc11 fix test result for windows 2017-08-25 20:52:55 +02:00