Commit graph

68687 commits

Author SHA1 Message Date
Marko Mäkelä
df563e0c03 Merge 10.2 into 10.3
main.derived_cond_pushdown: Move all 10.3 tests to the end,
trim trailing white space, and add an "End of 10.3 tests" marker.
Add --sorted_result to tests where the ordering is not deterministic.

main.win_percentile: Add --sorted_result to tests where the
ordering is no longer deterministic.
2018-11-06 09:40:39 +02:00
Marko Mäkelä
32062cc61c Merge 10.1 into 10.2 2018-11-06 08:41:48 +02:00
Sergei Petrunia
e058a251c1 MDEV-17518: Range optimization doesn't use ON expressions from nested outer joins
Part#2: take into account that join nest that we are marking as constant
might already have constant tables in it. Don't count these tables twice.
2018-11-05 21:10:15 +03:00
Sergei Petrunia
14b62b1578 MDEV-17518: Range optimization doesn't use ON expressions from nested outer joins
Continuation of the fix: Make condition selectivity estimate use the
right estimate, too.
2018-11-05 21:10:15 +03:00
Sergei Petrunia
3b6d903852 MDEV-17493: Partition pruning doesn't work for nested outer joins
Reuse the fix for MDEV-17518 here, too.
2018-11-05 21:10:15 +03:00
Sergei Petrunia
03680a9b4f MDEV-17518: Range optimization doesn't use ON expressions from nested outer joins 2018-11-05 21:10:15 +03:00
Marko Mäkelä
d63e198061 Merge 10.0 into 10.1 2018-11-05 12:15:17 +02:00
Sergei Golubchik
af9649c722 MDEV-17349 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed on concurrent SELECT and DELETE after RENAME from table with index on virtual column
Race condition. field->flags were copied from s->field->flags during
field->clone(), early in open_table_from_share(). But s->field->flags
were getting their PART_INDIRECT_KEY_FLAG bit much later in
TABLE::mark_columns_used_by_virtual_fields() and only once per share.

If two threads were executing the code between field->clone()
and mark_columns_used_by_virtual_fields() at the same time, only
one would get PART_INDIRECT_KEY_FLAG bits in field[].
2018-11-04 08:12:28 +01:00
Alexey Botchkov
6472c5c015 MDEV-15890 Strange error message if you try to FLUSH TABLES <view> after LOCK TABLES <view>.
LOCK view WRITE shouldn't block FLUSH view.
So we set the view's mdl_request type to it's tables.
2018-11-03 14:24:15 +04:00
Marko Mäkelä
8a346f31b9 MDEV-17073 INSERT…ON DUPLICATE KEY UPDATE became more deadlock-prone
thd_rpl_stmt_based(): A new predicate to check if statement-based
replication is active. (This can also hold when replication is not
in use, but binlog is.)

que_thr_stop(), row_ins_duplicate_error_in_clust(),
row_ins_sec_index_entry_low(), row_ins(): On a duplicate key error,
only lock all index records when statement-based replication is in use.
2018-11-02 18:52:39 +02:00
Vicențiu Ciorbaru
1c6b982e02 MDEV-12779 Oracle/DB2 Compatibility Implicit Ordering for ROW_NUMBER OVER
Users expect window functions to produce a certain ordering of rows in
the final result set. Although the standard does not require this, we
already have the filesort result done for when we computed the window
function. If there is no ORDER BY attached to the query, just keep it
till the SELECT is completely evaluated and use that to print the
result.

Update test cases as many did not take care to guarantee a stable
result.
2018-11-01 21:15:55 +02:00
Sergei Golubchik
dd6e74c62a MDEV-16774 SET PASSWORD and ALTER USER with slightly different results
set both `password` and `authentication_string` columns in `mysql`.`user`
table for now.

Suppress the "password was ignored" warning if the password is
the same as the authentication string
2018-11-01 15:48:15 +01:00
Varun Gupta
38b3e52c3c MDEV-16695: Estimate for rows of derived tables is very high when we are using index_merge union
For index merge union[or sort union], the estimates are not taken into account while calculating the selectivity of
a condition. So instead of showing the estimates of the index merge union[or sort union], it shows estimates equal to
all the records of the table.
The fix for the issue is to include the selectivity of index merge
union[or sort union] while calculating the selectivity of a condition.
2018-11-01 13:20:26 +05:30
Sergei Golubchik
44f6f44593 Merge branch '10.0' into 10.1 2018-10-30 15:10:01 +01:00
Daniel Black
3859273d04 MDEV-14267: correct FSF address 2018-10-30 19:45:09 +08:00
Monty
d30124e844 MDEV-17503 CREATE SEQUENCE failed with innodb_force_primary_key =1
Fixed by adding table flag HA_WANTS_PRIMARY_KEY, which is like
HA_REQUIRE_PRIMARY_KEY but tells SQL upper layer that the storage engine
internally can handle tables without primary keys (for example for
sequences or trough user variables)
2018-10-29 16:12:52 +02:00
Monty
6a6cc8a653 Remove not used table_flag HA_NO_VARCHAR 2018-10-29 15:48:49 +02:00
Sergei Golubchik
37ab7e4596 Merge branch '5.5' into 10.0 2018-10-27 20:46:38 +02:00
Varun Gupta
76318d55aa MDEV-17525: Window functions not working in ONLY_FULL_GROUP_BY mode
The ONLY_FULL_GROUP_BY mode states that for SELECT ... GROUP BY queries,
disallow SELECTing columns which are not referred to in the GROUP BY clause,
unless they are passed to an aggregate function like COUNT() or MAX().
This holds only for the GROUP BY clause of the query.
The code also checks this for the partition clause of the window function which is
incorrect.
2018-10-26 06:51:40 +02:00
Alexander Barkov
3e47b41a16 MDEV-17542 10.3: gcc-8.0 produces lots of -Wclass-memaccess warnings in Table_scope_and_contents_source_st 2018-10-25 14:07:31 +04:00
Sergei Golubchik
329058be29 wsrep: create a macro for the error: label
that is used by WSREP_TO_ISOLATION_BEGIN and other galera macros,
to avoid the need for wrapping this label in #ifdef WITH_WSREP/#endif
2018-10-24 14:48:08 +02:00
Sergei Golubchik
0140bfac5e MDEV-16127 mroonga/storage.* tests fail with GCC 8
Tests were failing because in TIME_from_longlong_datetime_packed() GCC8
at -O2 assumed that tmp is always positive and used mul and shr while it
used imul and sar at -O1 (where tests passed). GCC8 used multiplication
(by 0x4ec4ec4ec4ec4ec5) and shift to implement division by 13. It could
assume that tmp is always positive, because the function starts with
`if (tmp < 0) tmp= -tmp;`

But this assumption breaks if tmp=0x8000000000000000;
This is invalid value and TIME_from_longlong_datetime_packed() should
never see it, garbage in - garbage out.

It was getting this invalid value because mroonga tried to convert a
NULL key part to MYSQL_TIME. If the key part value is NULL, datetime2
value of it happens to be bzero-ed, which is invalid binary datetime2
value.

The correct behavior is not to try to interpret the key part value, if
it is marked as NULL. But this minimal fix only covers the datetime2 type.
2018-10-24 13:13:35 +02:00
Sergei Golubchik
f9e5195b40 Merge branch 'mysql/5.5' into 5.5 2018-10-23 15:59:24 +02:00
Vladislav Vaintroub
554ce5a0cc Attempt to fix build by a workaround for a bug in Windows8.1 SDK
Problem description and workaround are here
https://developercommunity.visualstudio.com/content/problem/185399/error-c2760-in-combaseapih-with-windows-sdk-81-and.html
2018-10-20 12:56:28 +01:00
Sergei Golubchik
55fc3fb088 Revert "MDEV-14429 sql_safe_updates in my.cnf not work"
This reverts commit dc3a20b191.

It requires GET_BIT in include/my_getopt.h, which is available
only in 10.3+
2018-10-20 13:29:27 +02:00
wlad
d6889f2b58 MDEV-17504 : add diagnostics if creation of directories fail in mysql_install_db.exe
In addition,don't remove datadir if it was not created or was not empty.
2018-10-19 21:58:28 +01:00
Sergey Vojtovich
642394197e Remove unused code. 2018-10-19 19:10:45 +04:00
Sergey Vojtovich
4ac85d6fd7 MDEV-14815 - Server crash or AddressSanitizer errors or valgrind warnings
in thr_lock / has_old_lock upon FLUSH TABLES

Explicit partition access of partitioned MEMORY table under LOCK TABLES
may cause subsequent statements to crash the server, deadlock, trigger
valgrind warnings or ASAN errors. Freed memory was being used due to
incorrect cleanup.

At least MyISAM and InnoDB don't seem to be affected, since their
THR_LOCK structures don't survive FLUSH TABLES. MEMORY keeps table shared
data (including THR_LOCK) even if there're no open instances.

There's partition_info::lock_partitions bitmap, which holds bits of
partitions allowed to be accessed after pruning. This bitmap is
updated for each individual statement.

This bitmap was abused in ha_partition::store_lock() such that when we
need to unlock a table, locked by LOCK TABLES, only locks for partitions
that were accessed by previous statement were released.

Eventually FLUSH TABLES frees THR_LOCK_DATA objects, which are still
linked into THR_LOCK lists. When such THR_LOCK gets reused we end up with
freed memory access.

Fixed by using ha_partition::m_locked_partitions bitmap similarly to
ha_partition::external_lock().
2018-10-19 19:09:48 +04:00
halfspawn
67f06cadc3 MDEV-17359 Concatenation operator || in like expression 2018-10-18 14:13:00 +04:00
Marko Mäkelä
f454189c60 Merge 10.2 into 10.3 2018-10-17 19:37:05 +03:00
Sachin
e31e697f17 MDEV-15919 lower_case_table_names does not behave as expected(nor...
consistently) on Replication Slave

lower_case_table_names  0 -> 1 replication works, it's safe as long as
 mixed case names mapping to the lower case ones is one-to-one
2018-10-17 10:46:20 +05:30
Alexander Barkov
8e716138ce MDEV-17257 Server crashes in Item::field_type_for_temporal_comparison or in get_datetime_value on SELECT with YEAR field and IN 2018-10-17 08:26:13 +04:00
Varun Gupta
97a37edc97 MDEV-17137: Syntax errors with VIEW using MEDIAN
The syntax error happened because we had not implemented a different print for
percentile functions. The syntax is a bit different when we use percentile functions
as window functions in comparision to normal window functions.
Implemented a seperate print function for percentile functions
2018-10-16 08:11:26 -07:00
Andrei Elkin
2308b9afec MDEV-17098 DATE -> DATETIME replication conversion not working, even in ALL_NON_LOSSY mode
Opened up MYSQL_TYPE _DATETIME{,2} <-> _NEWDATE conversions for replication.
2018-10-16 12:56:33 +03:00
Andrei Elkin
d8974ebd67 MDEV-14431 binlog.binlog_flush_binlogs_delete_domain failed in buildbot
The test and also rpl_gtid_delete_domain failed on PPC64 platform
due to an incorrectly specified actual key for searching
in a gtid domain system hash. While the correct size is 32 bits
the supplied value was 8 bytes of long int size on the platform.
The problem became evident thanks to the big endiness which
cut off the *least* significant part of the value field.

Fixed with correcting a dynamic array initialization to hold
now uint32 values as well as the values extraction for
searching in the gtid domain system hash.
A new added test ensures no overflowed values are accepted
for deletion which prevents inadvertent action. Notice though

MariaDB [test]> set @@session.gtid_domain_id=(1 << 32) + 1;
MariaDB [test]> show warnings;
+---------+------+--------------------------------------------------------+
| Level   | Code | Message                                                |
+---------+------+--------------------------------------------------------+
| Warning | 1292 | Truncated incorrect gtid_domain_id value: '4294967297' |
+---------+------+--------------------------------------------------------+
MariaDB [test]> select @@session.gtid_domain_id;
+--------------------------+
| @@session.gtid_domain_id |
+--------------------------+
|               4294967295 |
+--------------------------+
2018-10-16 12:42:57 +03:00
Sergey Vojtovich
bebe24b03b MDEV-11071 - Assertion `thd->transaction.stmt.is_empty()' failed in
Locked_tables_list::unlock_locked_tables

Similarly to regular DROP TABLE, don't leave locked tables mode if CREATE OR
REPLACE dropped temporary table but failed to cerate new one.

The problem is that there's no track of which temporary table was "locked" by
LOCK TABLES.
2018-10-16 13:24:15 +04:00
Vladislav Vaintroub
28ad5abade Merge branch 'bb-5.5-wlad' into 5.5 2018-10-15 12:59:04 +02:00
Vladislav Vaintroub
dc3a20b191 MDEV-14429 sql_safe_updates in my.cnf not work 2018-10-15 12:06:00 +02:00
Igor Babaev
103b1df510 MDEV-17222 Reproducible server crash in String_list::append_str or
in Field_iterator_table::create_item

When IN predicate is converted to IN subquery we have to ensure that
any item from the select list of the subquery has some name and this name
is unique across the select list.
This was not guaranteed by the code before the patch for MDEV-17222.
If the name of an item of the select list was not set, and this happened
for binary constants, then the server crashed. If the first row in the IN
list contained the same constant in two different positions then the server
returned an error message.
This was fixed by providing all constants in the first row of the IN list
with generated names.
2018-10-14 15:29:08 -07:00
Varun Gupta
af6077b535 MDEV-16990:server crashes in base_list_iterator::next
When we have a query which has implicit_grouping then we are sure that we would end up with only one
row so there is no point to do DISTINCT computation
2018-10-14 10:44:00 -07:00
Kristian Nielsen
74387028a0 Merge branch 'gtid_table_garbage_rows' into 10.3 2018-10-13 23:48:43 +02:00
Kristian Nielsen
1f8b0752ad Merge branch 'gtid_table_garbage_rows' into 10.1 2018-10-13 22:53:31 +02:00
Kristian Nielsen
61bba2a540 Fix build of embedded server 2018-10-13 22:53:12 +02:00
Kristian Nielsen
00164ea4b1 Merge branch 'gtid_table_garbage_rows_10.3' into 10.3 2018-10-13 19:50:53 +02:00
Kristian Nielsen
bc2903e744 Merge branch 'gtid_table_garbage_rows' into 10.1 2018-10-13 19:31:42 +02:00
Igor Babaev
6d29c8527b MDEV-17354 Server crashes in add_key_field / .. / Item_func_null_predicate::add_key_fields
upon INSERT .. SELECT

The function Item *Item_direct_view_ref::derived_field_transformer_for_where()
erroneously did not strip off ref wrappers from references to materialized
derived tables / views. As a result the expressions that contained some
references of the type Item_direct_view_ref to columns of a materialized
derived table / view V were pushed into V incorrectly. This could cause
crashes for some INSERT ... SELECT statements.
2018-10-12 11:45:04 -07:00
Marko Mäkelä
0f178e7cae Fix typo in 5936d43afb 2018-10-12 13:51:37 +03:00
Daniel Black
5936d43afb threadpool_size can contribute to the wanted_files 2018-10-12 08:22:10 +02:00
Alexander Barkov
4de0d920be MDEV-17411 Wrong WHERE optimization with simple CASE and searched CASE 2018-10-11 13:39:53 +04:00
Marko Mäkelä
ae9d82c9f8 Merge 10.2 into 10.3 2018-10-11 08:22:08 +03:00