Commit graph

65524 commits

Author SHA1 Message Date
Sergei Golubchik
7002291b8a Merge branch '10.0' into 10.1 2017-11-10 01:14:58 +01:00
Sergei Golubchik
7ec6c6fa62 typo 2017-11-09 20:47:56 +01:00
Alexander Barkov
0fdb0bdf27 Merge remote-tracking branch 'origin/10.0' into 10.1 2017-11-09 14:05:53 +04:00
Oleksandr Byelkin
c2c93fc6e4 MDEV-14164: Unknown column error when adding aggregate to function in oracle style procedure FOR loop
Make differentiation between pullout for merge and pulout of outer field during exists2in transformation.
In last case the field was outer and so we can safely start from name resolution context of the SELECT where it was pulled.
Old behavior lead to inconsistence between list of tables and outer name resolution context (which skips one SELECT for merge purposes) which creates problem vor name resolution.
2017-11-09 09:31:03 +01:00
Teemu Ollakka
736d75d455 MW-406 Bumped up the wsrep patch version (5.6.37-25.21) 2017-11-08 14:59:30 +02:00
sjaakola
c6251e36fc MW-399 Freeing wsrep_status_vars, before provider is released.
This is needed to clear THD::wsrep_status_vars reference,
which would otherwise remain to point to status variable array, which is no more effective.
2017-11-08 14:20:30 +02:00
sjaakola
f4f2e8fa2a MW-402 cascading FK issues
* created tests focusing in multi-master conflicts during cascading foreign key
  processing
* in row0upd.cc, calling wsrep_row_ups_check_foreign_constraints only when
  running in cluster
* in row0ins.cc fixed regression from MW-369, which caused crash with MW-402.test
2017-11-08 14:15:41 +02:00
Jan Lindström
e5e33db5fb MW-394
MariaDB adjustments.
2017-11-08 13:55:09 +02:00
sjaakola
7cedebb99b MW-394
* changed thd_binlog_format to return configured binlog format in wsrep execution,
  regardless of binlogging setting (i.e. with or without binlogging)
* thd_binlog_format is used in innobase::write_row(), and would return confusing
  result there when log_bin==OFF
2017-11-08 13:36:19 +02:00
Daniele Sciascia
b79407c5e9 MW-388 Remove unnecessary conditions 2017-11-08 12:49:27 +02:00
Jan Lindström
958ad5a880 MW-388 Fix conflict handling of SPs with DECLARE ... HANDLER
Adapt to MariaDB case
2017-11-08 12:25:46 +02:00
Daniele Sciascia
76f1195f5b MW-388 Fix conflict handling of SPs with DECLARE ... HANDLER
It is possible for a stored procedure that has an error handler
that catches SQLEXCEPTION to call thd->clear_error() on a thd
that failed certification. And because the error is cleared,
wsrep patch proceeds with the normal path and may try to commit
statements that should actually abort.
This patch catches the situation where wsrep_conflict_state is
still set, but the thd's error has been cleared, and rolls back
the statement in such cases.
2017-11-08 12:21:51 +02:00
Alexander Barkov
ca695888e0 MDEV-14116 INET6_NTOA output is set as null to varchar(39) variable 2017-11-07 21:57:42 +04:00
Sachin Setiya
3cecb1bab3 Merge tag 'mariadb-10.0.33' into bb-10.0-galera 2017-11-03 12:34:05 +05:30
Monty
5d0153c408 MDEV-12633 Error from valgrind related to dd_frm_type
"Conditional jump or move depends on uninitialised value in
my_scan_weight_utf8_general_ci, main.mysql_client_test fails in biuldbot
with valgrind"

- Fixed by ensuring that engine_name is set to empty string even in case
  errors in the .frm file
- Added some error checking to ha_table_exists()
2017-11-02 17:05:53 +02:00
Alexander Barkov
d8a9b524f2 MDEV-14221 Assertion `0' failed in Item::field_type_for_temporal_comparison 2017-11-02 16:58:37 +04:00
Marko Mäkelä
db203d7471 Merge 10.0 into 10.1 2017-10-24 20:36:03 +03:00
Igor Babaev
a1a79aa576 MDEV-13776 mysqld got signal 11 on delete returning
The method Field_iterator_table::create_item() must take into
account that it can be called when processing DELETE RETURNING.
2017-10-23 15:35:10 -07:00
Igor Babaev
acb336f75e MDEV-13607 MariaDB crash in fix_semijoin_strategies_for_picked_join_order
An overflow of the double variable storing the estimate of the
number of rows in a partial join could trigger an assertion
failure during the optimization stage.
2017-10-23 15:33:13 -07:00
Karthik Kamath
a542209b9e BUG#26529369: CREATE INDEX WITH LONG COMMENT CAUSE
UNEXPECTED ERROR

ANALYSIS:
=========
Creating many indexes with large amount of index
information causes a server exit.

FIX:
====
A appropriate error is reported when the cumulative index
information length exceeds the 2 byte range (i.e 65535).
2017-10-23 10:56:20 +05:30
Sergei Golubchik
2aa51f528f Various compier warnings
gcc 5.4 and 7.1, Debug and Release builds
2017-10-22 14:51:45 +02:00
Sergei Golubchik
9d2e2d7533 Merge branch '10.0' into 10.1 2017-10-22 13:03:41 +02:00
Sreeharsha Ramanavarapu
84c32cdbe7 Bug #26867652: INCORRECT BEHAVIOR WITH PREPARE STATEMENT
AND PARAM IN ORDER BY

Issue:
------
This issue can occur when the ORDER BY list refers to a
column that contains a parameter in the select list.

Solution:
---------
In JOIN::update_depend_map and get_sort_by_table, the
ORDER BY list's used_tables isn't checked for parameters.
This can result in incorrect behavior.

This is a partial backport of Roy's
2017-10-19 10:19:36 +05:30
Sergei Golubchik
da4503e956 Merge branch '5.5' into 10.0 2017-10-18 15:14:39 +02:00
Vicențiu Ciorbaru
4090ef820e Fix check_role_is_granted for embedded 2017-10-17 15:33:19 +03:00
Sergei Golubchik
b000e16956 Bug#26361149 MYSQL SERVER CRASHES AT: COL IN(IFNULL(CONST, COL), NAME_CONST('NAME', NULL))
based on:

commit f7316aa0c9
Author: Ajo Robert <ajo.robert@oracle.com>
Date:   Thu Aug 24 17:03:21 2017 +0530

    Bug#26361149  MYSQL SERVER CRASHES AT: COL IN(IFNULL(CONST,
                           COL), NAME_CONST('NAME', NULL))

    Backport of Bug#19143243 fix.

    NAME_CONST item can return NULL_ITEM type in case of incorrect arguments.
    NULL_ITEM has special processing in Item_func_in function.
    In Item_func_in::fix_length_and_dec an array of possible comparators is
    created. Since NAME_CONST function has NULL_ITEM type, corresponding
    array element is empty. Then NAME_CONST is wrapped to ITEM_CACHE.
    ITEM_CACHE can not return proper type(NULL_ITEM) in Item_func_in::val_int(),
    so the NULL_ITEM is attempted compared with an empty comparator.
    The fix is to disable the caching of Item_name_const item.
2017-10-17 11:04:09 +02:00
Sergei Golubchik
df5f25fa7a Merge branch 'mysql/5.5' into 5.5 2017-10-17 10:18:17 +02: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
Sergei Golubchik
19a702a85c MDEV-14056 DROP TEMPORARY TABLE IF EXISTS causes error 1290 with read_only option
if it's a DROP TABLE, we cannot detect whether a table is
temporary by looking in thd->temporary_tables - because the
table might simply not exist at all.
2017-10-17 07:37:39 +02:00
Sergei Golubchik
421716391b MDEV-13912 Can't refer the same column twice in one ALTER TABLE
backport ce6c0e584e

MDEV-8960: Can't refer the same column twice in one ALTER TABLE

Problem was that if column was created in alter table when
it was refered again it was not tried to find from list
of current columns.

mysql_prepare_alter_table:
  There is two cases
    (1) If alter table adds a new column and then later alter
        changes the field definition, there was no check from
	list of new columns, instead an incorrect error was given.
    (2) If alter table adds a new column and then later alter
        changes the default, there was no check from list of
	new columns, instead an incorrect error was given.
2017-10-17 07:37:39 +02:00
Sergei Golubchik
d76f5774fe MDEV-13459 Warnings, when compiling with gcc-7.x
mostly caused by -Wimplicit-fallthrough
2017-10-17 07:37:39 +02:00
Alexander Barkov
98cd0ec536 MDEV-10802 TIMESTAMP NOT NULL field with explicit_defaults_for_timestamp and NO_ZERO_DATE shouldn't throw error 2017-10-14 19:43:16 +04:00
Oleksandr Byelkin
3b7aa3017b Cleanup usage of DBUG_ASSERTS. 2017-10-13 19:32:38 +02:00
Oleksandr Byelkin
235b68299b MDEV-9619: Assertion `null_ref_table' failed in virtual table_map Item_direct_view_ref::used_tables() const on 2nd execution of PS
Refer left expression indirectly in case it changes from execution to execution.
2017-10-13 19:32:38 +02:00
Igor Babaev
2bab29ebba Fixed the bug mdev-13135.
For each SELECT the list sj_nests is built by the
function simplify_joins() when scanning different
join nests. This function may be called several
times for the same join nest. That's why before
adding a new member to sj_nests it is necessary
to check if it's already in the list.
The code of simplify_joins() lacked this check and
as a result it could cause memory overwright for
some queries.
2017-10-13 07:24:54 -07:00
Sergey Vojtovich
8be76a6a90 MDEV-10892 - rpl.rpl_semi_sync_uninstall_plugin fails with Assertion `0' failure
in buildbot

Removed plugin_array_version: it is being checked without mutex protection and
thus is prone to data race and race conditions. In effect plugins are not
protected from concurrent destruction.

Removed state_mask inversion: doesn't seem to make any sense.

When collecting local plugins list, only add plugins that match state_mask.

Use plugin ref counting to protect against concurrent plugin destruction.
2017-10-13 16:50:58 +04:00
Oleksandr Byelkin
a4868c3509 MDEV-9208: Function->Function->View = Mysqld segfault (Server crashes in Dependency_marker::visit_field on 2nd execution with merged subquery)
Prevent crossing name resolution border in finding item tables.
2017-10-13 12:35:17 +02: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
Vesa Pentti
93aadda513 MDEV-13149 -- show function status now works with PAD_CHAR_TO_FULL_LENGTH 2017-10-10 16:16:12 +03:00
Alexander Barkov
c2509a1588 MDEV-13972 crash in Item_func_sec_to_time::get_date 2017-10-10 10:35:12 +04:00
Sergei Golubchik
9b11956e86 MDEV-13049 Querying INFORMATION_SCHEMA becomes slow in MariaDB 10.1
Optimizations:
* avoid faster ext_table_discovery_simple() *only* when there are
  engines with discover_table_names() method *and* they look at
  file names. P_S implements discover_table_names(), but it's not
  a reason to use slower extension_based_table_discovery().
* don't pre-sort table names if ORDER BY or GROUP BY was specified
* starting from 10.3 only sort table names for SHOW commands
2017-10-09 17:58:28 +02:00
Sergei Golubchik
559dec33cc cleanup: is_show_command(thd) 2017-10-09 17:58:28 +02:00
Tor Didriksen
aa6e69db10 Backport patch for Bug#16877045 5.6-CLUSTER-7.3 WIN32 SQL_YACC.CC BUILD PROBLEM
Building with ninja shows the problem:
cmake .. -G Ninja
ninja
ninja: error: dependency cycle: sql/GenServerSource -> sql/CMakeFiles/GenServerSource -> sql/sql_builtin.cc -> cmake_order_depends_target_sq
 sql/GenServerSource

Bug#16877045 5.6-CLUSTER-7.3 WIN32 SQL_YACC.CC BUILD PROBLEM
 - Somewhat circular dependency caused by the configured files sql_builtin.cc  being included as
    part of the files to generate in sql/
 - Move sql_builtin.cc out of GEN_SOURCES variable.
 - Create new variable CONF_SOURCES to be used for configured files.
2017-10-09 16:24:11 +02:00
Alexey Botchkov
5eb666ad37 MDEV-12705 10.1.18-MariaDB-1~jessie - mysqld got signal 11.
Space for the next operation wasn't reserved in
        Item_func_spatial_relate::val_str()
2017-10-07 14:17:45 +04:00
Alexander Barkov
ca948e335e MDEV-9886 Illegal mix of collations with a view comparing a field to a binary constant 2017-10-07 13:42:11 +04:00
Alexander Barkov
e30b6a983f MDEV-11819 NO_ZERO_IN_DATE: Incorrect generated column value 2017-10-06 18:23:40 +04:00
Igor Babaev
dbeffabc83 Fixed the bug mdev-11574.
Do not build an index merge of two indexes when one index is
an infix of the other index.
2017-10-06 00:08:36 -07:00
Alexander Barkov
1cfaafafee MDEV-13242 Wrong results for queries with row constructors and information_schema 2017-10-05 13:41:16 +04:00
Sergei Golubchik
f0e9bebd27 MDEV-13897 SELECT @a := MAX(col) FROM t requires full index scan
fix some old bad merge
2017-09-27 10:22:15 +02:00
Sergei Golubchik
f7628ca3c2 cleanup: remove useless "inline" keywords
avoid a function call for a commonly used one-liner.
followup for 0627929f62
2017-09-27 10:22:14 +02:00
Sachin Setiya
0627929f62 MDEV-13787 Crash in persistent stats wsrep_on (thd=0x0)
Problem:- This crash happens because of thd = NULL , and while checking
for wsrep_on , we no longer check for thd != NULL (MDEV-7955). So this
problem is regression of MDEV-7955. However this patch not only solves
this regression , It solves all regression caused by MDEV-7955 patch.

To get all possible cases when thd can be null , assert(thd)/
assert(trx->mysql_thd) is place just before all wsrep_on and innodb test
suite is run. And the assert which caused failure are removed with a physical
check for thd != NULL. Rest assert are removed. Hopefully this method will
remove all current/potential regression of MDEV-7955.
2017-09-27 10:15:08 +05:30
Marko Mäkelä
84be33abe0 Merge 10.0 into 10.1 2017-09-25 09:50:24 +03:00
Varun Gupta
f91eb71e1c MDEV-8840: ANALYZE FORMAT=JSON produces wrong data with BKA
The issue was that r_loops, r_rows and r_filtered in ANALYZE FORMAT= JSON were not
calculated for the table on which we were performing the MRR scan in the BKA join
Fixed this by adding respective counter in the JOIN_TAB_SCAN_MRR::open and JOIN_TAB_SCAN_MRR::next
2017-09-24 23:37:57 +05:30
Vladislav Vaintroub
7128fefa4c Fix compile with -DWITHOUT_DYNAMIC_PLUGINS on Unix 2017-09-23 23:23:05 +02:00
Sergei Golubchik
f8a800bec8 bugfix: copy timestamps correctly in INSERT...SELECT
don't do it via MYSQL_TIME, that conversion is lossy
around DST change dates.
2017-09-21 22:03:28 +02:00
Sergei Golubchik
f4f48e0621 MDEV-12672 Replicated TIMESTAMP fields given wrong value near DST change
Implement a special Copy_field method for timestamps, that copies
timestamps without converting them to MYSQL_TIME (the conversion
is lossy around DST change dates).
2017-09-21 22:03:21 +02:00
Sergei Golubchik
2e3a16e366 Merge branch '10.0' into 10.1 2017-09-21 22:02:21 +02:00
Sergei Golubchik
8d0448d507 MDEV-13861 Assertion `0' failed in Protocol::end_statement
followup for 378beed0a6 - only count WARN_LEVEL_ERROR,
not warnings or notes.
2017-09-21 21:43:07 +02:00
Sergei Golubchik
1015196e0a cleanup: TABLE_LIST::view_check_option
don't prepare for checking view's CHECK OPTION, if
there is no CHECK OPTION in the first place.
2017-09-21 10:04:29 +02:00
Sachin Setiya
e84f5356c3 MDEV-12290 Wrong timestamps in binary log causes replication issues
Binlog_background_thread does not make a call to set_time(), And when
we call binlog_checkpoint_log_event->write() , we write the wrong timestamp.
In this patch we correct this by calling thd->set_time().
2017-09-21 13:22:49 +05:30
Sergei Golubchik
378beed0a6 MDEV-13290: Assertion Assertion !is_set() || (m_status == DA_OK_BULK && is_bulk_op())' or ! is_set()' failed
followup for 97c2a7354b - don't use thd->is_error(),
the error could've been set before TABLE_LIST::cleanup_items.
Use the error handler to count errors.

This fixes rpl.rpl_row_binlog_max_cache_size - it was failing when
ER_STMT_CACHE_FULL happened duing multi-table update. Because
multi_update::abort_result_set() calls do_updates() to update
as much as possible, so one cannot rely on thd->is_error() after that.
2017-09-20 20:02:17 +02:00
Vicențiu Ciorbaru
c9e111202e Merge branch '10.0' into 10.1 2017-09-20 10:35:11 +03:00
Vicențiu Ciorbaru
78f6f2b73b Merge branch 'bb-10.1-vicentiu' into 10.1 2017-09-20 10:25:51 +03:00
Vicențiu Ciorbaru
20d4cac6db Merge branch 'bb-10.0-vicentiu' into 10.0 2017-09-20 10:24:31 +03:00
Jan Lindström
0b9437951c MDEV-13850: Uninitialized variable at wsrep_binlog.cc:455 2017-09-20 09:57:39 +03:00
Oleksandr Byelkin
97c2a7354b MDEV-13290: Assertion Assertion !is_set() || (m_status == DA_OK_BULK && is_bulk_op())' or ! is_set()' failed
Check error status which can be set by conversion procedures.
2017-09-19 16:19:06 +02:00
Vicențiu Ciorbaru
ec6042bda0 Merge branch '10.0' into 10.1 2017-09-19 12:06:50 +03:00
Vicențiu Ciorbaru
ba0ee91077 Merge branch '10.0-galera' into 10.1 2017-09-19 10:20:01 +03:00
Vicențiu Ciorbaru
0f44c8ab28 Fix merge error 2017-09-19 02:05:11 +03:00
Vicențiu Ciorbaru
d6a7de2022 Merge branch '5.5' into 10.0 2017-09-19 01:02:01 +03:00
Sergei Golubchik
a5ee77393f MDEV-13157 Specifying DATA DIRECTORY in tables leads to failing EXCHANGE PARTITION 2017-09-18 10:40:26 +02:00
Marko Mäkelä
372dba097d Silence a -Wimplicit-fallthrough warning 2017-09-17 14:13:32 +03:00
Alexander Barkov
65d26d1f31 MDEV-10191 non convertible chars convert() resulted in Null instead "?" on Windows
The problem was introduced by the patch for MDEV-7661,
which (in addition to the fix itself) included an attempt to make
CONVERT/CAST work in the same way with fields
(i.e. return NULL in strict mode if a non-convertable character found).
It appeared to be a bad idea and some users were affected by this
behavior change. Changing CONVERT/CAST not depend on sql_mode
(restoring pre-10.1.4 behavior).
2017-09-15 20:59:04 +04: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
Vladislav Vaintroub
65c94238f8 Merge branch 'bb-10.0-wlad' into 10.0 2017-09-09 10:55:47 +00:00
Vladislav Vaintroub
a46679dcf7 Build improvements and cleanups.
- the probably ultimate fix for dependencies on VS
- remove some GET_TARGET_PROPERTY(LOCATION ...), they are deprecated in
cmake 3.9
- simplify signing targets on Windows.
- remove INSTALL_DEBUG_TARGET, we do not mix binaries from different builds
in the same package
2017-09-08 18:22:15 +00:00
Marko Mäkelä
cd694d76ce Merge 10.0 into 10.1 2017-09-06 15:32:56 +03:00
Sreeharsha Ramanavarapu
ad00de4077 Bug #26704451: INCORRECT BEHAVIOR WITH USE OF CERTAIN
CHARSETS AND SHA2

Missed pushing to 5.5.
2017-09-06 06:45:50 +05:30
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ä
7f99381288 Fix compiler warnings
metadata_lock_info_duration[]: Remove the unused variable.

Add some comments /* fall through */ to silence -Wimplicit-fallthrough
2017-09-01 15:40:49 +03:00
Marko Mäkelä
be45f083e6 Merge 10.0 into 10.1 2017-08-31 18:04:44 +03:00
Vladislav Vaintroub
6be93c3b8a MDEV-13693 : Fix parameter passing to my_error.
char* parameter is expected by the message ER_KEY_COLUMN_DOES_NOT_EXITS,
thus pass char*, rather than LEX_STRING.
2017-08-31 14:57:56 +00:00
Jan Lindström
eba0120d8f Fix test failures on embedded server.
Problem was incorrect definition of wsrep_recovery,
trx_sys_update_wsrep_checkpoint and
trx_sys_read_wsrep_checkpoint functions causing
innodb_plugin not to load as there was undefined symbols.
2017-08-31 14:04:02 +03:00
Aakanksha Verma
9ae160af76 2017-08-31 15:44:42 +05:30
Marko Mäkelä
829752973b Merge branch '10.0' into 10.1 2017-08-30 13:06:13 +03:00
Marko Mäkelä
4c91fd4cd6 Galera after-merge fixes
wsrep_drop_table_query(): Remove the definition of this ununsed function.

row_upd_sec_index_entry(), row_upd_clust_rec_by_insert():
Evaluate the simplest conditions first. The merge could have slightly
hurt performance by causing extra calls to wsrep_on().
2017-08-30 12:29:47 +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
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ä
11352d52cd Merge 10.0 into 10.1 2017-08-28 15:05:46 +03:00
Ajo Robert
f7316aa0c9 Bug#26361149 MYSQL SERVER CRASHES AT: COL IN(IFNULL(CONST,
COL), NAME_CONST('NAME', NULL))

Backport of Bug#19143243 fix.

NAME_CONST item can return NULL_ITEM type in case of incorrect arguments.
NULL_ITEM has special processing in Item_func_in function.
In Item_func_in::fix_length_and_dec an array of possible comparators is
created. Since NAME_CONST function has NULL_ITEM type, corresponding
array element is empty. Then NAME_CONST is wrapped to ITEM_CACHE.
ITEM_CACHE can not return proper type(NULL_ITEM) in Item_func_in::val_int(),
so the NULL_ITEM is attempted compared with an empty comparator.
The fix is to disable the caching of Item_name_const item.
2017-08-24 17:03:21 +05:30
Sachin Setiya
5077cc0b1a Fix Merge Error 2017-08-23 16:49:42 +05:30
Nisha Gopalakrishnan
be901b60ae Bug#26390632: CREATE TABLE CAN CAUSE MYSQL TO EXIT.
Analysis
========
CREATE TABLE of InnoDB table with a partition name
which exceeds the path limit can cause the server
to exit.

During the preparation of the partition name,
there was no check to identify whether the complete
path name for partition exceeds the max supported
path length, causing the server to exit during
subsequent processing.

Fix
===
During the preparation of partition name, check and report
an error if the partition path name exceeds the maximum path
name limit.

This is a 5.5 patch.
2017-08-23 12:59:38 +05:30
Tor Didriksen
ebd96c3149 Bug#19875294 ASSERTION `SRC' FAILED IN MY_STRNXFRM_UNICODE (SIG 6 -STRINGS/CTYPE-UTF8.C:5151)
Backport from 5.7 to 5.5 Field_set::val_str()
should return String("", 0, cs) rather than String(NULL, 0, cs)
2017-08-23 07:32:49 +02:00
Venkatesh Duggirala
d75f8a1742 Bug#24763131 LOCAL-INFILE DEFAULT SHOULD BE DISABLED
Problem & Analysis: Slave's Receiver thread, Applier thread and worker
    threads are created with LOCAL-INFILE option enabled. As the document
    says https://dev.mysql.com/doc/refman/5.7/en/load-data-local.html,
    there are some issues if a thread enables local infile.
    This flag should be enabled with care. But for the above mentioned
    internal threads, server is enabling it at the time of creation.

Fix: Further analysis on the code shows that none of threads really
    need this flag to be enabled at any time as Slave never executes
    "LOAD DATA LOCAL INFILE" after reading it from Relay log.
    Applier thread removes "LOCAL" before start executing the query.
2017-08-23 09:16:12 +05:30
Jan Lindström
0aeff8c36a Fix compiler error. 2017-08-21 14:48:30 +03:00
Jan Lindström
c23efc7d50 Merge remote-tracking branch 'origin/10.0-galera' into 10.1 2017-08-21 13:35:00 +03:00
Jan Lindström
ce6c0e584e MDEV-8960: Can't refer the same column twice in one ALTER TABLE
Problem was that if column was created in alter table when
it was refered again it was not tried to find from list
of current columns.

mysql_prepare_alter_table:
  There is two cases
    (1) If alter table adds a new column and then later alter
        changes the field definition, there was no check from
	list of new columns, instead an incorrect error was given.
    (2) If alter table adds a new column and then later alter
        changes the default, there was no check from list of
	new columns, instead an incorrect error was given.
2017-08-18 10:11:54 +03:00
Oleksandr Byelkin
bcc1ba9218 MDEV-11240: Server crashes in check_view_single_update or Assertion `derived->table' failed in mysql_derived_merge_for_insert
Before "merge" view shoud be inited to maintaing transitive attributes like "multitable".
2017-08-16 19:18:39 +02:00
Jan Lindström
5017c261d4 Fix test failure on test MW-86 and remove MW-360 test.
Merged from mysql-wsrep-bugs following:

GCF-1058 MTR test galera.MW-86 fails on repeated runs
Wait for the sync point sync.wsrep_apply_cb to be reached before
executing the test and clearing the debug flag sync.wsrep_apply_cb.

The race scenario:

Intended behavior:
node2: set sync.wsrep_apply_cb in order to start waiting in the background INSERT
node1: INSERT start
node2 (background): INSERT start
node1: INSERT end
node2: send signal to background INSERT: "stop waiting and continue executing"
node2: clear sync.wsrep_apply_cb as no longer needed
node2 (background): consume the signal
node2 (background): INSERT end
node2: DROP TABLE
node2: check no pending signals are left - ok

What happens occasionally (unexpected):
node2: set sync.wsrep_apply_cb in order to start waiting in the background INSERT
node1: INSERT start
node2 (background): INSERT start
node1: INSERT end
// The background INSERT still has _not_ reached the place where it starts
// waiting for the signal:
// DBUG_EXECUTE_IF("sync.wsrep_apply_cb", "now wait_for...");
node2: send signal to background INSERT: "stop waiting and continue executing"
node2: clear sync.wsrep_apply_cb as no longer needed
// The background INSERT reaches DBUG_EXECUTE_IF("sync.wsrep_apply_cb", ...)
// but sync.wsrep_apply_cb has already been cleared and the "wait" code is not
// executed. The signal remains unconsumed.
node2 (background): INSERT end
node2: DROP TABLE
node2: check no pending signals are left - failure, signal.wsrep_apply_cb is
pending (not consumed)

Remove MW-360 test case as it is not intended for MariaDB (uses
MySQL GTID).
2017-08-15 13:57:15 +03:00
=Ian Gilfillan
f066c89a97 MDEV-8579 Expand system variable documentation 2017-08-15 10:13:57 +04:00
sjaakola
224ae5770f Refs: MW-363 * enabling binlog file copying even for binlog files with basename "0" * mtr suite uses binlog files with names: 0.000001, 0.000002.. and so on 2017-08-14 14:41:05 +03:00
sjaakola
7ee47ef456 MW-378 enabling build with WITH_WSREP=OFF only one fix here, enables build of mysqld however, building embedded server fails in linking phase 2017-08-14 14:40:25 +03:00
Daniele Sciascia
f81d9ef108 MW-86 Removed unnecessary wsrep_sync_wait before processing SQLCOM_REPLACE
Sync waiting before processing SQLCOM_REPLACE was not necessary given that
this case falls through to processing of SQLCOM_INSERT. In case of
SQLCOM_REPLACE, wsrep_sync_wait would be called twice.
2017-08-14 12:00:09 +03:00
Daniele Sciascia
62cd7553d9 MW-86 Additional wsrep_sync_wait coverage
The following commands are now subject to wsrep_sync_wait
with bitmask value 8:

SHOW BINARY LOGS
SHOW BINLOG EVENTS
SHOW GRANTS
2017-08-14 11:59:52 +03:00
sjaakola
795713405b Refs: MW-360 * fix for regression with galera_toi_ddl_nonconflicting test 2017-08-14 11:44:22 +03:00
Daniele Sciascia
f20b21a29a MW-86 Adjust MTR tests for changes to wsrep_sync_wait 2017-08-14 11:42:13 +03:00
Daniele Sciascia
7a219b6f23 MW-86 Add separate wsrep_sync_wait bitmask value for SHOW commands
Previously, setting `wsrep_sync_wait = 1` would have an effect on
both SELECT and SHOW statements.
This patch changes wsrep_sync_wait so that bitmask value 1 is used
for SELECT statements, while bitmask value 8 is reserved for SHOW
statements.
It is still possible to achieve sync wait on both SELECT and SHOW
statements by setting `wsrep_sync_wait = 9`.
2017-08-14 08:50:02 +03:00
Alexey Yurchenko
83664e21e4 MW-366 Improved support for IPv6 networks - made mysqld and SST scripts to recognize []-escaped IPv6 addresses - pulled in latest Percona and MariaDB updates to SST scripts - instruct netcat and socat in wsrep_sst_xtrabackup-v2 to listen on IPv6 socket via sockopt parameter in the [sst] section of my.cnf
In summary, wsrep_node_address and wsrep_sst_receive_address can now
be set to IPv6 addresses escaped by []. Rsync SST works out ouf the
box thanks to rsync daemon listening on both IPv4 and IPv6 sockets by
default. For xtrabackup SST onver IPv6 one needs to set sockopt in
the [sst] section of joiner's configuration file to ",pf=ip6" if
using socat as a streamer or to "-6" if using netcat.
2017-08-11 15:00:18 +03:00
sjaakola
5fb1260365 Refs: MW-360, white space fix 2017-08-11 14:12:10 +03:00
sjaakola
ba3d26d3ab Refs: MW-360 * fixes required in pull request review 2017-08-11 14:11:45 +03:00
sjaakola
790a8274cd Refs: MW-360 * reverted WSREP_TO_ISOLATION macros back to original form 2017-08-11 14:06:16 +03:00
sjaakola
04c6b03c9b Refs: MW-360 * merged relevant parts of DROP TABLE query splitting from mysql-wsrep-features 2017-08-11 13:49:01 +03:00
sjaakola
a754387a09 Refs: MW-360, fix for compiler warning 2017-08-11 13:24:18 +03:00
sjaakola
7ef2d5aa5b Refs: MW-360 * splitting DROP TABLE query in separate DROP commands for temporary and real tables * not replicating temporary table DROP command * using wsrep_sidno GTID group only for innodb table drop command part all this follows more or less the logic of how mysql wants to split drop table list 2017-08-11 13:23:51 +03:00
Daniele Sciascia
364b15c090 MW-336 Avoid slave threads leaking
This patch fixes two problems that may arise when changing the
value of wsrep_slave_threads:

1) Threads may be leaked if wsrep_slave_threads is changed
   repeatedly. Specifically, when changing the number of slave
   threads, we keep track of wsrep_slave_count_change, the
   number of slaves to start / stop. The problem arises when
   wsrep_slave_count_change is updated before slaves had a
   chance to exit (threads may take some time to exit, as they
   exit only after commiting one more replication event).
   The fix is to update wsrep_slave_count_change such that it
   reflects the number of threads that already exited or are
   scheduled to exit.

2) Attempting to set out of range value for wsrep_slave_threads
   (below 1 / above 512) results in wsrep_slave_count_change to
   be computed based on the out of range value, even though a
   warning is generated and wsrep_slave_threads is set to a
   truncated value. wsrep_slave_count_change is computed in
   wsrep_slave_threads_check(), which is called before mysql
   checks for valid range. Fix is to update wsrep_count_change
   whenever wsrep_slave_threads is updated with a valid value.
2017-08-11 12:31:26 +03:00
Daniele Sciascia
77f5b188d3 MW-357 Reset thd->wsrep_apply_toi regardless of applier exiting
Applier does not reset thd->wsrep_apply_toi if applier thread decides
to exit by setting 'exit= true'. The problem is that galera side may
decide not to kill the applier thread: for instance if we try to
SET wsrep_slave_threads = 0; then galera refuses to kill the last
applier thread. If this happens we are left with a thd which has not
been reset to the initial state.
This patch ensures that the thd is reset regardless of the applier
thread exiting or not.
2017-08-11 12:17:22 +03:00
Varun Gupta
0739179857 MDEV-13458: Wrong result for aggregate function with distinct clause when the value for tmp_table_size is small
Fixed by making sure that the sort buffer would have atleast MERGEBUFF2 keys.
Also fixed MDEV-13457 by making sure that an empty tree is never dumped to the disk
2017-08-09 18:09:04 +05:30
Jan Lindström
56b03e308f Merge tag 'mariadb-10.0.32' into 10.0-galera 2017-08-09 08:56:11 +03:00
Sergei Golubchik
5099d6de61 MDEV-12863 No table can be created after second encryption plugin attempted to load
when deinitializing encryption plugins, disable server-wide encryption
only if this plugin is the one that is used for encryption.
2017-08-08 14:52:08 +02:00
Sergei Golubchik
8e8d42ddf0 Merge branch '10.0' into 10.1 2017-08-08 10:18:43 +02:00
Monty
19f2b3d02f Fixed compiler warnings 2017-08-07 03:48:58 +03:00
Monty
74543698a7 MDEV-13179 main.errors fails with wrong errno
The problem was that the introduction of max-thread-mem-used can cause
an allocation error very early, even before mysql_parse() is called.
As mysql_parse() calls thd->reset_for_next_command(), which called
clear_error(), the error number was lost.

Fixed by adding an option to have unique messages for each KILL
signal and change max-thread-mem-used to use this new feature.
This removes a lot of problems with the original approach, where
one could get errors signaled silenty almost any time.

ixed by moving clear_error() from reset_for_next_command() to
do_command(), before any memory allocation for the thread.

Related changes:
- reset_for_next_command() now have an optional parameter if we should
  call clear_error() or not. By default it's called, but not anymore from
  dispatch_command() which was the original problem.
- Added optional paramater to clear_error() to force calling of
  reset_diagnostics_area(). Before clear_error() only called
  reset_diagnostics_area() if there was no error, so we normally
  called reset_diagnostics_area() twice.
- This change removed several duplicated calls to clear_error()
  when starting a query.
- Reset max_mem_used on COM_QUIT, to protect against kill during
  quit.
- Use fatal_error() instead of setting is_fatal_error (cleanup)
- Set fatal_error if max_thead_mem_used is signaled.
  (Same logic we use for other places where we are out of resources)
2017-08-07 03:48:58 +03:00
Monty
e35670f498 MDEV-12972 Random and Frequent Segfault
Problem was a memory overflow in MRR

Reviewed by Sergei Petruna. Testcase by Elena
2017-08-03 19:28:05 +03:00
Sergei Golubchik
e6e23c0d49 MDEV-9739 Assertion `m_status == DA_ERROR || m_status == DA_OK' failed in Diagnostics_area::message() ; connect.xml* tests fail in buildbot 2017-08-01 09:52:57 +02:00
Sergei Golubchik
60343871a7 MDEV-8453 Alter table not returning engine errors
remove ~15 years old print_lock_error() function, use
handler::print_error() instead

Backport from 10.1
2017-08-01 09:52:57 +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
Vicențiu Ciorbaru
af40426fcd Fix purge_relay_logs post merge
slave_skip_counter must not be reset to 0 during purge_relay_logs. See
MDEV-4937 as to when this change happened.
2017-07-27 16:22:37 +03:00
Sergei Golubchik
7134afa22e MYSQL_BIN_LOG::open/close must be under LOCK_log 2017-07-27 12:43:45 +02:00
Sergei Golubchik
c784277590 move the error message where it belongs 2017-07-27 12:43:03 +02:00
Sergei Golubchik
2804a3fac4 memory leak: add a missing end_relay_log_info() 2017-07-27 12:42:21 +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
3ef5596505 MDEV-13175 Adding a new enum value at the end of a list triggers a table rebuild
Backport of 7e29f2d64f from 10.1.

Create_field does not set BINARY_FLAG, so the check didn't work at all.
Also, character sets were already compared, so this check would've been
redundant (if it would've worked).
2017-07-20 20:13:28 +02:00
Sergei Golubchik
2fcd8c1252 MDEV-13173 An RLIKE that previously worked on 10.0 now returns "Got error 'pcre_exec: recursion limit of 100 exceeded' from regexp"
1. use Regexp_processor_pcre::set_recursion_limit() to set the
   recursion limit depending on the current available stack size
2. make pcre stack frame to be estimated no less than 500 bytes.
   sometimes pcre estimates it too low, even though the manual
   says 500+16 bytes (it was estimated only 188 for me, actual
   frame size was 512).
3. do it for embedded too
2017-07-20 20:13:28 +02:00
Sergei Golubchik
dc8b2fb03a MDEV-11896 thd_get_error_context_description race condition
Change the semantics of thd_get_error_context_description().
It no longer expects the caller to lock LOCK_thread_count
(no caller ever did that anyway), but takes care of it internally.
2017-07-20 20:13:28 +02:00
Sergei Golubchik
da2a838628 MDEV-12824 GCC 7 warning: this statement may fall through [-Wimplicit-fallthrough=] 2017-07-20 20:13:28 +02:00
Sergei Golubchik
58aaae6f2a ensure that filename in COM_BINLOG_DUMP isn't too long 2017-07-18 16:42:40 +02:00
Daniel Black
172e3a1bc6 MDEV-12646: Apply fixes found by Coverity static analysis tool
Inspired by: https://github.com/devexp-db/mariadb/blob/f27/mariadb-covscan-stroverflow.patch
2017-07-18 15:53:31 +02:00
Sergei Golubchik
9b3360ea44 BUG#25250768: WRITING ON A READ_ONLY=ON SERVER WITHOUT SUPER PRIVILEGE
simplify.
add a test case.
2017-07-18 14:59:33 +02:00
Sergei Golubchik
9a5fe1f4ea Merge remote-tracking branch 'mysql/5.5' into 5.5 2017-07-18 14:59:10 +02:00
Oleksandr Byelkin
e7fd6ed387 MDEV-11240: Server crashes in check_view_single_update or Assertion `derived->table' failed in mysql_derived_merge_for_insert
Move table pointer for single table view (even if it is view over other view) to make the access universal.
2017-07-18 13:49:58 +02:00
Alexey Botchkov
7e44eabdad MDEV-11205 UDF_ARGS "attribute_lengths" incorrect value.
Set name_length properly in Item_idnet constructors.
2017-07-18 13:19:34 +04:00
Sergei Golubchik
27bc13b7a2 MDEV-12136 SELECT COUNT(DISTINCT) returns the wrong value when tmp_table_size is limited
Same MDEV, second bug.
Merge buffer must fit at least MERGEBUFF2 (that is, 15) key values.
Because merge_index() can merge that many buffers, and
merge_many_buff() leaves that many buffers unmerged.
2017-07-13 11:23:54 +02:00
Sergei Golubchik
e7f51e5d26 MDEV-12136 SELECT COUNT(DISTINCT) returns the wrong value when tmp_table_size is limited
use the correct value for the merge_buffer size, max_in_memory_size
is too small and merge_walk() fails.

also: remove a cast.
2017-07-12 19:20:52 +02:00
Sergei Golubchik
05b678bc8c MDEV-12489 The select stmt may fail due to "having clause is ambiguous" unexpected
only compare field references with an alias (from the SELECT clause)
when this reference doesn't specify an explicit table name part.
2017-07-12 17:46:19 +02:00
Sergei Golubchik
c83d6ff881 compiler warning
remove unused variable
2017-07-12 13:55:04 +02:00
Sergei Golubchik
be55bbc2b2 MDEV-7826 Server crashes in Item_subselect::enumerate_field_refs_processor
upper->item can be NULL if we're referring to an aggregate function
2017-07-12 12:49:29 +02:00
Sergei Golubchik
c5975eaea1 MDEV-7339 Server crashes in Item_func_trig_cond::val_int
Item_in_subselect::pushed_cond_guards[] array is allocated only when
left_expr->maybe_null. And it is used (for row expressions) when
left_expr->element_index(i)->maybe_null.

For left_expr being a multi-column subquery, its maybe_null is
always false when the subquery doesn't use tables (see
Item_singlerow_subselect::fix_length_and_dec()
and subselect_single_select_engine::fix_length_and_dec()),
otherwise it's always true.

But row elements can be NULL regardless, so let's always allocate
pushed_cond_guards for multi-column subqueries, no matter whether
its maybe_null was forced to true or false.
2017-07-12 10:39:02 +02:00
Alexey Botchkov
a06f2f430f MDEV-12078 Using spatial index changes type from point to geometry
In get_mm_tree we have to change Field_geom::geom_type to
        GEOMETRY as we have to let storing all types of the spatial features
        in the field. So now we restore the original geom_type as it's
        done.
2017-07-11 23:27:19 +04:00
Sergei Golubchik
9e11e055ce Merge branch '10.0' into 10.1 2017-07-07 11:30:03 +02:00