Commit graph

69470 commits

Author SHA1 Message Date
Alexander Barkov
371d6ac1bd MDEV-19197 Move ASSERT_COLUMN_MARKED_FOR_XXX as methods to Field 2019-04-06 11:38:18 +04:00
Igor Babaev
18bf0bf496 MDEV-18956 Assertion `sel->quick' failed in JOIN::make_range_rowid_filters
If SUBS_IN_TO_EXISTS strategy has been chosen for a subquery then
additional conditions are injected into WHERE/ON/HAVING of this subquery
and it may happen that test_quick_select() invoked from
JOIN::make_range_rowid_filters() discovers impossible range. This
must be checked.
2019-04-05 23:14:05 -07:00
Galina Shalygina
a2e477ffd0 MDEV-19186: Assertion `field->table == table' failed in create_tmp_table
Temporary table is defined with the view field in HAVING.
Item_direct_view_ref for this field is dropped and that causes error.

To fix it Item_direct_view_ref::remove_item_direct_ref() is added.
2019-04-06 00:04:52 +03:00
Galina Shalygina
694d1a50bd MDEV-19185: Pushdown constant function defined with subquery
The bug occurs because of the wrong pushdown of constant function
defined with subquery from HAVING into WHERE. Subqueries can't be
pushed into WHERE.

To fix it with_subquery() call is added to check if the function contains
subquery.
2019-04-05 22:55:20 +03:00
Alexander Barkov
c84dde148f MDEV-19184 Crash in IS_IPV6(_ucs2 0x0031) 2019-04-05 16:29:13 +04:00
Marko Mäkelä
02d9b048a2 Merge 10.3 into 10.4 2019-04-05 11:41:03 +03:00
Igor Babaev
d2013e7328 MDEV-18982 Partition pruning with column list causes syntax error in 10.4
A syntax error was reported for any INSERT statement with explicit
partition selection it if i used a column list.
Fixed by saving the parsing place before parsing the clause for explicit
partition selection and restoring it when the clause has been parsed.
2019-04-04 16:36:26 -07:00
Marko Mäkelä
d5a2bc6a0f Merge 10.2 into 10.3 2019-04-04 19:41:12 +03:00
Galina Shalygina
ae15f91f22 MDEV-18769 Assertion `fixed == 1' failed in Item_cond_or::val_int
This bug is caused by pushdown from HAVING into WHERE.
    It appears because condition that is pushed wasn't fixed.

    It is also discovered that condition pushdown from HAVING into
    WHERE is done wrong. There is no need to build clones for some
    conditions that can be pushed. They can be simply moved from HAVING
    into WHERE without cloning.
    build_pushable_cond_for_having_pushdown(),
    remove_pushed_top_conjuncts_for_having() methods are changed.

    It is found that there is no transformation made for fields of
    pushed condition.
    field_transformer_for_having_pushdown transformer is added.

    New tests are added. Some comments are changed.
2019-04-04 18:06:56 +03:00
Marko Mäkelä
b30fb701cc Merge 10.1 into 10.2 2019-04-04 09:05:45 +03:00
Marko Mäkelä
6a9b216301 Fix clang -Wunused-private-field 2019-04-03 19:50:51 +03:00
Marko Mäkelä
1f3bcff1f2 Remove unused declarations 2019-04-03 19:46:34 +03:00
Eugene Kosov
3a3d5ba235 MDEV-13301 Optimize DROP INDEX, ADD INDEX into RENAME INDEX
Just rename index in data dictionary and in InnoDB cache when it's possible.
Introduce ALTER_INDEX_RENAME for that purpose so that engines can optimize
such operation.

Unused code between macro MYSQL_RENAME_INDEX was removed.

compare_keys_but_name(): compare index definitions except for index names

Alter_inplace_info::rename_keys:
ha_innobase_inplace_ctx::rename_keys: vector of rename indexes

fill_alter_inplace_info():: fills Alter_inplace_info::rename_keys
2019-04-03 18:36:33 +02:00
Sergey Vojtovich
5d8ca98997 Get rid of rea_create_table()
Moved rea_create_table() to the sole caller.

Also ha_create_partitioning_metadata(CHF_CREATE_FLAG) does cleanup on
error now.

Part of MDEV-17805 - Remove InnoDB cache for temporary tables.
2019-04-03 17:43:12 +04:00
Sergey Vojtovich
38e151d155 Fix inplace ALTER TABLE to not register tmp table
Do not register intermediate tables created by inplace ALTER TABLE in
THD::temporary_tables.

Regular ALTER TABLE doesn't create .frm for temporary and discoverable
tables anymore. For inplace ALTER TABLE moved .frm creation to
create_table_for_inplace_alter().

Removed open_in_engine argument of create_and_open_tmp_table() and
open_temporary_table(): it became unused after this patch.

Part of MDEV-17805 - Remove InnoDB cache for temporary tables.
2019-04-03 17:38:26 +04:00
Sergey Vojtovich
914bb5387f Removed redundant partitioning check
This check was introduced in 602a222 and then became redundant in ad1553e,
where we attempt to open a table even for non-copy algorithms.

Added missing test case from 602a222.

Part of MDEV-17805 - Remove InnoDB cache for temporary tables.
2019-04-03 16:47:27 +04:00
Sergey Vojtovich
878f83151f Simplified dd_recreate_table()
It is used only with persistent tables, so remove path argument, which
was introduced in 9594107f and became useless after ce6a63e.

Part of MDEV-17805 - Remove InnoDB cache for temporary tables.
2019-04-03 16:47:26 +04:00
Sergey Vojtovich
1dac55cf0e Removed redundant SE lock for tmp tables
CREATE TEMPORARY TABLE locks SE plugin 6 times. 5 of these locks are
released by the end of the statement. And only 1 acquired by
init_from_binary_frm_image() / plugin_lock() remains.

The lock removed in this patch was clearly redundant.

Part of MDEV-17805 - Remove InnoDB cache for temporary tables.
2019-04-03 16:47:25 +04:00
Marko Mäkelä
c8f8d5ceb7 Merge 10.3 into 10.4 2019-04-03 11:43:39 +03:00
Marko Mäkelä
c6b8b05be4 Merge 10.2 into 10.3 2019-04-03 11:22:51 +03:00
Marko Mäkelä
5f31f8cc87 Fix cmake -DWITH_WSREP=OFF
Provide a dummy definition of WSREP_NNULL.
This was broken in commit b896f60a73.
2019-04-03 10:56:55 +03:00
Marko Mäkelä
dbc716675b Merge 10.1 into 10.2 2019-04-03 10:32:21 +03:00
Sachin
ba7d33a898 MDEV-18820 Assertion `lock_table_has(trx, index->table, LOCK_IX)' failed in lock_rec_insert_check_and_lock upon INSERT into table with blob key
Don't Ignore Any error during index lookup, And throw duplicate key error
only if error is HA_ERR_FOUND_DUPP_KEY
2019-04-03 12:53:58 +05:30
Marko Mäkelä
b896f60a73 Fix -Wformat and -Wnonnull-compare for WSREP 2019-04-03 09:20:21 +03:00
Varun Gupta
0dc442ac61 MDEV-18942: Json_writer::add_bool: Conditional jump or move depends on uninitialised value upon fulltext search under optimizer trace
For keyuse of fulltext set the value for null_rejecting to FALSE
as we don't add NOT NULL keys for fulltext keyuses
2019-04-03 00:32:26 +05:30
Varun Gupta
eac97ef44c MDEV-18962: ASAN heap-buffer-overflow in Single_line_formatting_helper::on_add_str with optimizer trace
Fixed a typo
2019-04-03 00:32:26 +05:30
Sergei Golubchik
65d758aa89 MDEV-18298 Crashes server with segfault during role grants
it was supposed to be `*(p-1)` not `*p-1`
(the crash happens if `*p==0`)
2019-04-02 18:22:37 +02:00
Alexander Barkov
4d12a6458e MDEV-19125 Change Send_field::type from enum_field_types to Type_handler* 2019-04-02 17:04:20 +04:00
Nikita Malyavin
610ec192ec MDEV-17320 add Feature_application_time_periods status variable
Closes #1225
2019-04-02 11:03:32 +02:00
Nikita Malyavin
5fc6ad95d4 MDEV-18921 Server crashes in bitmap_bits_set or bitmap_is_set upon UPDATE IGNORE .. FOR PORTION with binary logging
The fix is same as for MDEV-18859: initialize table->rpl_write_set in
FOR PORTION OF case.
2019-04-02 11:03:32 +02:00
Nikita Malyavin
7e3e2d060b MDEV-18859 Server crashes in bitmap_bits_set / pack_row / THD::binlog_write_row upon DELETE .. FOR PORTION with binary logging
rpl_write_set is initialized in TABLE::mark_columns_per_binlog_row_image.
Since we just call use_all_columns for PORTION OF case, no need in
column marking logic here. Instead, initialize table->rpl_write_set in
place.
2019-04-02 11:03:32 +02:00
Nikita Malyavin
04055060b6 MDEV-18852 MDEV-18853 fix period.delete, period.update tests crashes with `--ps-protocol
The main problem was lack of proper QueryArena handling in
`period_setup_conds`. Since mysql_prepare_update/mysql_prepare_delete
are called during `PREPARE` statement, period conditions, should be
allocated on statement query arena.

Another problem is incorrect statement state handling in
period_setup_conds, which led to unexpected mysql_update termination.

* mysql_update: move period_setup_conds() to mysql_prepare_update to
  store conditions in statement's mem_root

* mtr: add period suite to default list, since --ps-protocol is now
  fixed

Fixes bugs:
MDEV-18853 Assertion `0' failed in Protocol::end_statement upon DELETE .. FOR PORTION via prepared statement
MDEV-18852 Server crashes in reinit_stmt_before_use upon UPDATE .. FOR PORTION via prepared statement
2019-04-02 11:03:32 +02:00
Sergei Golubchik
79fe17567a gcc 8 warnings 2019-04-02 12:00:04 +03:00
Marko Mäkelä
5c3ff5cb93 Merge 10.3 into 10.4 2019-04-02 11:04:54 +03:00
Alexander Barkov
ea5cda5269 MDEV-18402 Assertion `sec.sec() <= 59' failed in Item_func_maketime::get_date 2019-04-02 11:40:22 +04:00
Alexander Barkov
b9ea778f6c MDEV-18503 Assertion `native.length() == binlen' failed in Type_handler_timestamp_common::make_sort_key 2019-04-02 11:06:07 +04:00
Alexander Barkov
5201a1d080 MDEV-18240 Assertion `0' failed in Item_cache_timestamp::val_datetime_packed 2019-04-02 09:56:31 +04:00
Alexander Barkov
1b4bb3b5bb MDEV-19124 Assertion `0' failed in Item::val_native 2019-04-02 09:13:16 +04:00
Monty
48810a0014 MDEV-19116 Speed up rotation of binary logs
Fixed by caching last binary log number used in last_used_log_number

Other things:
- Moved locking of LOCK_log form new_file_impl() to new_file(). This fixed
  a bug where LOCK_log could have been unlocked even if 'need_lock' was
  not set.  Removed not anymore used argument need_lock.
- Made generate_new_name() virtual to simplify the code between
  other logs and binary log.

Reviewed by Andrei Elkin
2019-04-01 19:47:24 +03:00
Monty
adb7016214 MDEV-19117 Don't keep binary log index file locked during show binary logs
On some systems with 10,000+ binlogs, show binary logs could block
log rotation for more than 10 seconds.

This patch fixes this by first caching all binary log names and
releases all mutexes while calculating the sizes of the binary logs.

Other things:
- Ensure that reinit_io_cache() sets end_of_file when moving to read_cache.
  This ensures that external changes of the underlying file is known to
  the cache.
- get_binlog_list() is made more efficent and show_binlogs() is changed
  to call get_binlog_list()

Reviewed by Andrei Elkin
2019-04-01 19:47:24 +03:00
Michael Widenius
6fd7a4b601 Fixed uninitialized bug in Range_rowid_filter_cost_info 2019-04-01 19:47:24 +03:00
Monty
5b15f68e0f Fixed valgrind warning: Wrong usage of c_ptr() 2019-04-01 19:47:24 +03:00
Alexander Barkov
2d825e97df Cleanup: removing unused type LEX_TYPE and #include 2019-04-01 10:09:24 +04:00
Sergei Golubchik
ed661a0e59 post-merge: -Werror fixes in 10.3 2019-03-29 19:42:01 +01:00
Sergei Golubchik
4e1d3f83b7 Merge branch '10.2' into 10.3 2019-03-29 19:41:41 +01:00
Vladislav Vaintroub
39f195052c MDEV-19068 - rename eventlog source to MariaDB. 2019-03-29 16:50:38 +01:00
Nikita Malyavin
39d7e5969b MDEV-16252: MINIMAL binlog_row_image does not work for versioned tables
* mark columns for binlog before inserting history row

Closes #822
2019-03-29 12:51:19 +01:00
Sergei Golubchik
8123d79911 MDEV-15951 system versioning by trx id doesn't work with partitioning
Clarify the error message, use the wording from the manual.

Closes #870
2019-03-29 12:51:19 +01:00
Nikita Malyavin
e6230e844c MDEV-15951 system versioning by trx id doesn't work with partitioning
Fix partitioning for trx_id-versioned tables.
`partition by hash`, `range` and others now work.
`partition by system_time` is forbidden.
Currently we cannot use row_start and row_end in `partition by`, because
insertion of versioned field is done by engine's handler, as well as
row_start/row_end's value set up, which is a transaction id -- so it's
also forbidden.

The drawback is that it's now impossible to use `partition by key()`
without parameters for such tables, because it references row_start and
row_end implicitly.

* add handler::vers_can_native()
* drop Table_scope_and_contents_source_st::vers_native()
* drop partition_element::find_engine_flag as unused
* forbid versioning partitioning for trx_id as not supported
* adopt vers tests for trx_id partitioning
* forbid any row_end referencing in `partition by` clauses,
  including implicit `by key()`
2019-03-29 12:51:19 +01:00
Aleksey Midenkov
8df04fb894 MDEV-15412 For any non-existing transaction ID, AS OF provides the current table contents without a warning
Fail with error on non-existing TRX_ID.

Closes #832
2019-03-29 12:51:19 +01:00