Commit graph

69505 commits

Author SHA1 Message Date
Sergey Vojtovich
f189f34ed4 Move XID_STATE::rm_error to XID_cache_element
XID_STATE::rm_error is never used by internal 2PC, it is intended to be
used by explicit XA only.

Also removed redundant xid reset from THD::init_for_queries(). Must've
been done already either by THD::transaction constructor or by
THD::cleanup().

Part of MDEV-7974 - backport fix for mysql bug#12161 (XA and binlog)
2019-04-25 15:06:40 +04:00
Sergey Vojtovich
07140f171d Just move, no code changes otherwise.
Part of MDEV-7974 - backport fix for mysql bug#12161 (XA and binlog)
2019-04-25 15:06:40 +04:00
Alexander Barkov
ca7fbcea6c MDEV-19317 TEXT column accepts too long literals as a default value
Adding new virtual methods in Field:
- make_empty_rec_store_default_value()
- make_empty_rec_reset()

This simplifies the logic for every Field type,
and makes the code more friendly to pluggable data types.
2019-04-25 08:26:08 +04:00
Alexander Barkov
baadbe9601 MDEV-9234 Add Type_handler::union_element_finalize() 2019-04-23 13:45:28 +04:00
Galina Shalygina
a765b19e5c MDEV-19245: Impossible WHERE should be noticed earlier after HAVING pushdown
The bug appears because not all conditions are found to be knowingly
true or false in WHERE after HAVING pushdown optimization.
Impossible WHERE can be found much earlier compared with how it is done now.

To fix it and_new_conditions_to_optimized_cond() is changed.
2019-04-22 16:19:55 +03:00
Igor Babaev
a65d3b2c16 MDEV-19255 Server crash in st_join_table::save_explain_data or assertion
`sel->quick' failure in JOIN::make_range_rowid_filters upon query
           with rowid_filter=ON

Index ranges can be defined using conditions with inexpensive subqueries.
Such a subquery is evaluated when some representation of a possible range
sequence is built. After the evaluation the JOIN structure of the subsquery is distroyed.
Any attempt to build the above representation may fail because the
function that checks whether a subquery is inexpensive in some cases uses
the join structure of the subquery.
When a range rowid filter is built by a range sequence constructed out of
a range condition that uses an inexpensive subquery the representation of
the the sequence is built twice. Building the second representation fails
due to the described problem with the execution of Item_subselect::is_expensive().
The function was corrected to return the result of the last its invocation
if the Item_subselect object has been already evaluated.
2019-04-19 16:18:48 -07:00
Monty
38f390f549 MDEV-19224 Assertion `marked_for_read()' failed
Problem was that wrong key_info variable was used, which caused UNIQUE
key to be used as a covering key
2019-04-19 13:22:01 +03:00
Monty
c07e346ca6 MDEV-19252 Problem with DBUG_ASSERT_AS_PRINTF and marked_for_write()
Problem was that DBUG_FIX_WRITE_SET was not enabled when using
DBUG_ASSERT_AS_PRINTF
2019-04-19 13:20:15 +03:00
Monty
a024649081 Fixed compiler warnings form gcc 7.3.1 2019-04-19 13:17:14 +03:00
Alexander Barkov
4233b28489 MDEV-19283 Move the code from Field_str::is_equal() to Field_string::is_equal() 2019-04-19 07:00:41 +04:00
Sergei Petrunia
878ca5ca4f MDEV-19266: Crash in EITS code when enabling 128 indexes
Do not attempt to set param->table->with_impossible_ranges if the
range optimizer is using pseudo-indexes (which is true when we are
computing EITS selectivity estimates or doing partition pruning).
2019-04-18 18:56:14 +03:00
Vladislav Vaintroub
6812fb7971 MDEV-19274 mariadb does not build on OSes that do not have HAVE_POOL_OF_THREADS
Do not try to compile threadpool_common.cc, if threadpool is not available
on current OS.

Also introduced undocumented/uncached CMake variable DISABLE_THREADPOOL,
to emulate builds on exotic OSes.
2019-04-18 07:37:05 +01:00
Igor Babaev
59ed5f3aa4 MDEV-19164 Assertion `fixed' failed in Item_func_inet_aton::val_int
When pushing a condition from HAVING into WHERE the function
st_select_lex::pushdown_from_having_into_where() transforms column
references in the pushed condition then performs cleanup of
items of the condition and finally calls fix_fields() for the condition
items. The cleanup is performed by a call of the method walk() with
cleanup_processor as the first parameter. Unfortunately this sequence
of calls does not work if the condition contains cached items, because
fix_fields() cannot go through Item_cache items and this leaves
underlying items unfixed.
The solution of this problem used in this patch is just does not allow
to process Item_cache objects when performing cleanup of the pushed
condition. In order to let the traversal procedure walk() not to process
Item_cache objects the third parameter of the used call of walk()
is set to a fictitious pointer (void *) 1. And Item_cache::walk() is
changed to prevent any action when it gets such value as the third
parameter.
2019-04-17 21:37:29 -07:00
Marko Mäkelä
e7029e864f Merge 10.3 into 10.4 2019-04-17 15:59:30 +03:00
Alexander Barkov
ee4a2fef18 Adding missing ';' at the end of a rule 2019-04-17 08:16:41 +04:00
Oleksandr Byelkin
f202f3dfe6 MDEV-19263: Server crashes in mysql_handle_single_derived upon 2nd execution of PS
Fix case of prelocking placeholder
2019-04-16 23:21:04 +02:00
Igor Babaev
645f77a6bc MDEV-19195 Active Record unit test fails with MariaDB 10.4.3
Currently usage of range rowid filters can be combined only with
ref access and single index range access. So if the optimizer has
chosen some other quick select method to access a joined table
then no range rowid filter can be used for this table.
2019-04-16 16:51:21 +02:00
willhan
f66e006b08 fix bug for spider where using "not like" (#890)
test case:
t1 is a spider engine table;
  CREATE TABLE `t1` (
  `id` int(11) NOT NULL DEFAULT '0',
  `name` char(64) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=SPIDER

query: "select * from t1 where name  not like 'x%' " would dispatch "select xxx name name like 'x%' " to remote mysqld, is wrong
2019-04-16 23:10:05 +09:00
Oleksandr Byelkin
8701e5b095 Cleanup of sql_derived.cc file 2019-04-16 11:58:56 +02:00
Oleksandr Byelkin
eb056f8726 MDEV-17362: SIGSEGV in JOIN::optimize_inner or Assertion `fixed == 0' failed in Item_equal::fix_fields, server crashes after 2nd execution of PS
Move reinitialisation of pushdown variables for every query, because it used now not only for derived tables.
2019-04-16 09:25:43 +02:00
Oleksandr Byelkin
6c306a729d Cleanup of derived table interface 2019-04-16 08:57:24 +02:00
wayne
a2335b791a Typo fix in sql_sequence.cc 2019-04-15 23:46:02 -07:00
Alexander Barkov
3bc863b208 MDEV-19256 sql_acl.cc does not compile with WITH_VALGRIND with gcc 8.0
Turning initializing code into constructors.
2019-04-16 08:20:57 +04:00
Alexander Barkov
c2a2e72164 MDEV-19142 sql_mode=MSSQL: Bracket identifiers 2019-04-15 09:39:28 +04:00
Kentoku SHIBA
857310c218
MDEV-16543 Replicating to spider is fragile without retries (#1259) 2019-04-12 22:58:37 +09:00
Marko Mäkelä
7896503686 Merge 10.3 into 10.4 2019-04-12 12:45:06 +03:00
Eugene Kosov
4dc10ec68d MDEV-19236 Improve error message for ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COLUMN_TYPE
remove a sometimes misleading word INPLACE from error message
2019-04-12 12:28:09 +03:00
Jan Lindström
71848585f8 Fix InnoDB dynamic plugin compile errors on wsrep patch. 2019-04-10 11:19:38 +03:00
Marko Mäkelä
edd1a53a55 Merge 10.3 into 10.4 2019-04-08 22:00:07 +03:00
Marko Mäkelä
9ba0865b87 Merge 10.2 into 10.3 2019-04-08 21:38:13 +03:00
Marko Mäkelä
d8303c3ee7 Merge 10.3 into 10.4 2019-04-08 08:22:34 +03:00
Sergei Golubchik
5023e465a9 copy-paste error fixed
thanks @FaramosCZ
2019-04-07 15:49:30 +02:00
Marko Mäkelä
cc492bfd4f Merge 10.2 into 10.3 2019-04-07 11:49:50 +03:00
Teemu Ollakka
eb872ceb27 Fixed wsrep replaying for stored procedures (#1256)
- Changed replaying to always allocate a separate THD object
  for applying log events. This is to avoid tampering original
  THD state during replay process.
- Return success from sp_instr_stmt::exec_core() if replaying
  succeeds.
- Do not push warnings/errors into diagnostics area if the
  transaction must be replayed. This is to avoid reporting
  transient errors to the client.

Added two tests galera_sp_bf_abort, galera_sp_insert_parallel.
Wsrep-lib position updated.
2019-04-06 12:33:51 +03:00
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
Igor Babaev
b4a7bde76c MDEV-19112 WITH clause does not work with information_schema as default database
With INFORMATION_SCHEMA set as the default database the check that a table
referred in the processed query is defined in INORMATION_SCHEMA must
be postponed until all CTE names can be identified.
2019-04-05 15:00:42 -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