Commit graph

177129 commits

Author SHA1 Message Date
Oleksandr Byelkin
189157d052 Merge branch '10.1' into bb-10.1-merge-sanja 2018-07-26 06:34:33 +02:00
Oleksandr Byelkin
cb5952b506 Merge branch '10.0' into bb-10.1-merge-sanja 2018-07-25 22:24:40 +02:00
Varun Gupta
37dee22d27 MDEV-15454: Nested SELECT IN returns wrong results
In this case we are setting the field Item_func_eq::in_eqaulity_no for the semi-join equalities.
This helps us to remove these equalites as the inner tables are not available during parent select execution
while the outer tables are not available during materialization phase.
We only have it set for the equalites for the fields involved with the IN subquery
and reset it for the equalities which do not belong to the IN subquery.

For example in case of nested IN subqueries:

    SELECT t1.a FROM t1 WHERE t1.a IN
      (SELECT t2.a FROM t2 where t2.b IN
          (select t3.b from t3 where t3.c=27 ))

there are two equalites involving the fields of the IN subquery

1) t2.b = t3.b :  the field Item_func_eq::in_eqaulity_no is set when we merge the grandchild select into the child select
2) t1.a = t2.a :  the field Item_func_eq::in_eqaulity_no is set when we merge the child select into the parent select

But when we perform case 2) we should ensure that we reset the equalities in the child's WHERE clause.
2018-07-25 21:21:27 +05:30
Varun Gupta
f9b43c2565 MDEV-16751: Server crashes in st_join_table::cleanup or TABLE_LIST::is_with_table_recursive_reference
with join_cache_level>2

During muliple equality propagation for a query in which we have an IN subquery, the items in the select list of the
subquery may not be part of the multiple equality because there might be another occurence of the same field in the
where clause of the subquery.
So we keyuse_is_valid_for_access_in_chosen_plan function which expects the items in the select list of the subquery to
be same to the ones in the multiple equality (through these multiple equalities we create keyuse array).
The solution would be that we expect the same field not the same Item because when we have SEMI JOIN MATERIALIZATION SCAN,
we use copy back technique to copies back the materialised table fields to the original fields of the base tables.
2018-07-25 14:20:16 +05:30
Igor Babaev
1fde449f1d MDEV-16820 Lost 'Impossible where' from query with inexpensive subquery
This patch fixes another problem introduced by the patch for mdev-4817.
The latter changed Item_cond::fix_fields() in such a way that it could
call the virtual method is_expensive(). With the first its call
the method saves the result in Item::is_expensive_cache. For all next
calls the method returns the result from this cache. So if the item
once was determined as expensive the method always returns true.
For subqueries it's not good, because non-optimized subqueries always
is considered as expensive.
It means that the cache should be invalidated after the call of
optimize_constant_subqueries().
2018-07-24 23:53:12 -07:00
Igor Babaev
c631060713 MDEV-16820 Lost 'Impossible where' from query with inexpensive subquery
This patch fixes another problem introduced by the patch for mdev-4817.
The latter changed Item_cond::fix_fields() in such a way that it could
call the virtual method is_expensive(). With the first its call
the method saves the result in Item::is_expensive_cache. For all next
calls the method returns the result from this cache. So if the item
once was determined as expensive the method always returns true.
For subqueries it's not good, because non-optimized subqueries always
is considered as expensive.
It means that the cache should be invalidated after the call of
optimize_constant_subqueries().
2018-07-24 23:45:55 -07:00
Jan Lindström
57cde8ccd1 MDEV-15822: WSREP: BF lock wait long for trx
In Galera BF (brute force) transactions may not wait for lock requests
and normally BF-transaction would select transaction holding conflicting
locks as a victim for rollback. However, background statistic calculation
transaction is InnoDB internal transaction and it has no thd i.e. it can't be
selected as a victim. If background statistics calculation transaction holds
conflicting locks to statistics tables it will cause BF lock wait long
error message. Correct way to handle background statistics calculation is to
acquire thd for transaction but that change is too big for GA-releases and
there are other reported problems on background statistics calculation.

This fix avoids adding a table to background statistics calculation if
2018-07-25 08:24:09 +03:00
Igor Babaev
d567f1611e MDEV-16820 Lost 'Impossible where' from query with inexpensive subquery
This patch fixes another problem introduced by the patch for mdev-4817.
The latter changed Item_cond::fix_fields() in such a way that it could
call the virtual method is_expensive(). With the first its call
the method saves the result in Item::is_expensive_cache. For all next
calls the method returns the result from this cache. So if the item
once was determined as expensive the method always returns true.
For subqueries it's not good, because non-optimized subqueries always
is considered as expensive.
It means that the cache should be invalidated after the call of
optimize_constant_subqueries().
2018-07-24 20:00:28 -07:00
Elena Stepanova
1bda5e3a8f List of unstable tests for 10.0.36 release 2018-07-24 20:09:42 +03:00
Oleksandr Byelkin
9fbe360e9f make plugins.processlist more robust 2018-07-24 18:29:17 +02:00
Oleksandr Byelkin
e0139c2b92 fix plugins.processlist
make it not to fail when `show engine innodb status` output
contains a double quote
2018-07-24 18:16:41 +02:00
Oleksandr "Sanja" Byelkin
5e67567b15
Merge pull request #726 from fauust/10.0-MDEV-14672
MDEV-14672 Minor upgrade fails on xenial due to missing unixODBC (case-sensitive)
2018-07-24 10:42:35 +02:00
Oleksandr Byelkin
304440b014 Merge branch '5.5' into bb-10.0-merge-sanja 2018-07-23 11:55:18 +02:00
Oleksandr Byelkin
a0d33dc6ef MDEV-16689: core-file should become a real server variable
Mysql Bug#56124 bug analog fix using Sys_var_bit.
2018-07-20 17:35:52 +02:00
Igor Babaev
9cea4ccf12 MDEV-16726 Assertion `tab->type == JT_REF || tab->type == JT_EQ_REF' failed
Due to a legacy bug in the code of make_join_statistics() detecting
so-called constant tables could miss some of them in rare queries
that used RIGHT JOIN. As a result these queries had execution plans
different from the execution plans of the equivalent queries with
LEFT JOIN.
Besides starting from 10.2 this could trigger an assertion failure.
2018-07-19 15:31:46 -07:00
Jan Lindström
323f269d40 MDEV-10564: Galera wsrep_debug patch logs MySQL user credentials
Restricted output for CREATE USER, GRANT, REVOKE and SET PASSWORD
so that it shows only above keywords but not rest of query i.e.
not user or password.
2018-07-19 20:35:27 +03:00
Oleksandr Byelkin
fb4b3472d2 Merge branch '10.1' into bb-10.1-merge-sanja 2018-07-19 19:13:44 +02:00
Oleksandr Byelkin
0896d7ebc3 Merge branch '10.0' into bb-10.1-merge 2018-07-19 12:55:54 +02:00
Sergei Golubchik
d57ddaa190 MDEV-15551 Server hangs or assertion `strcmp(share->unique_file_name,filename) || share->last_version' fails in test_if_reopen or unexpected ER_LOCK_DEADLOCK
only use HA_EXTRA_PREPARE_FOR_DROP when the table is going to be dropped
2018-07-19 11:35:39 +02:00
Sergei Golubchik
5c744bb535 MDEV-14882 mysql_upgrade performs unnecessary conversions back and forth
avoid round-robin conversions, if the column is MODIFY-ed,
it should always be modified to its final definition, not to some
intermediate state.

also avoid other unconditional changes, like
  ALTER TABLE event DROP PRIMARY KEY;
  ALTER TABLE event ADD PRIMARY KEY(db, name);
2018-07-19 11:35:39 +02:00
Sergei Golubchik
40f29ecbf1 MDEV-13397 MariaDB upgrade fail when using default_time_zone
don't try to set default time zone in --bootstrap,
this generally cannot be done, as timezone tables aren't loaded.
and bootstrap scripts don't need it anyway.
2018-07-19 11:35:38 +02:00
Sergei Golubchik
33eccb5776 MDEV-11790 WITHOUT_SERVER installs mysqld_safe_helper
Don't install server files if WITHOUT_SERVER is specified.
"Server files" are defined as files going into the MariaDB-Server RPM,
that is files in the components Server, ManPagesServer, Server_Scripts,
IniFiles, SuportFiles, and Readme.
2018-07-19 11:35:38 +02:00
Sergei Golubchik
bd5cf02bbe MDEV-11741 handler::ha_reset(): Assertion `bitmap_is_set_all(&table->s->all_set)' failed or server crash in mi_reset or buffer overrun or unexpected ER_CANT_REMOVE_ALL_FIELDS
MEMORY table could be renamed into a non-extistent database.

rename() is documented to return ENOENT when the source file does not
exist OR when the target directory not exist. Nonexistent source .frm
file is ok (table can still exist in the engine), nonexistent target
directory is not.

Make my_rename to use ENOTDIR for the latter case. Make RENAME TABLE
issue an appropriate error ("unknown database" instead of "unknown table")
2018-07-19 11:35:38 +02:00
Sergei Golubchik
0b3e28a4cd MDEV-8941 Compile on Solaris (SPARC) fails with errors in filamvct.cpp
remove unnecessary declaration
2018-07-19 11:35:38 +02:00
Sergei Petrunia
09f147659f MDEV-16777: galera.galera_gra_log fails with File ...GRA_*.log not found error
snprintf returns the number of bytes it wrote (or would have written) NOT
counting the \0 terminal character.
The buffer size it accepts as argument DOES COUNT the \0 character.
Pass the right parameter value.
2018-07-19 12:07:07 +03:00
Alexander Barkov
e2ac4098ed Simplify caseup() and casedn() in charsets
After the MDEV-13118 fix there's no code in the server that
wants caseup/casedn to change the argument in place for simple
charsets.  Let's remove this logic and always return the result in a
new string for all charsets, both simple and complex.

1. Removing the optimization that *some* character sets used in casedn()
  and caseup(), which allowed (and required) to change the case in-place,
  overwriting the string passed as the "src" argument.
  Now all CHARSET_INFO's work in the same way:
  non of them change the source string in-place, all of them now convert
  case from the source string to the destination string, leaving
  the source string untouched.

2. Adding "const" qualifier to the "char *src" parameter
   to caseup() and casedn().

3. Removing duplicate implementations in ctype-mb.c.
  Now both caseup() and casedn() implementations for all CJK character sets
  use internally the same function my_casefold_mb()
  (the former my_casefold_mb_varlen()).

4. Removing the "unused" attribute from parameters of some my_case{up|dn}_xxx()
   implementations, as the affected parameters are now *used* in the code.
   Previously these parameters were used only in DBUG_ASSERT().
2018-07-19 13:02:14 +04:00
Alexander Barkov
ab58493db2 MDEV-13118 Wrong results with LOWER and UPPER and subquery
This problem is similar to MDEV-10306.

1. Fixing Item_str_conv::val_str(String *str) to return the result in "str",
   and to use tmp_value only as a temporary buffer for args[0]->val_str().
   The new code version now guarantees that the result is always returned in
   "str". The trick with copy_if_not_alloced() is not used any more.

2. The change #1 revealed the same problem in SUBSTRING_INDEX(),
   so some tests with combinations of UPPER()/LOWER() and SUBSTRING_INDEX()
   started to fail. Fixing Item_func_substr_index::val_str() the same way,
   to return the result in "str" and use tmp_value as a temporary buffer
   for args[0]->val_str().
2018-07-19 09:55:51 +04:00
Jan Lindström
4d06b7e1bd MDEV-16769: Notes "WSREP: Waiting for SST to complete" flood the error log
Used wrong initialization for condition timeout, should have
used set_timespec.
2018-07-18 17:13:32 +03:00
sachin
ada54101a7 MDEV-9266 Creating index on temporaray table breaks replication
Problem:- Create/drop index was logged into binlog.

Goal:- Operation on temporary table should not be binlog when binlog format
is row.

Solution:-
We should add CF_FORCE_ORIGINAL_BINLOG_FORMAT when there is ddl on temp
table.
For optimize, analyze, repair we wont change anything ,Then will
be logged in binlog , But they also dont throw any error if operation fails
Since slave wont be having any temp table , but these operation on tmp
table will be processed without breaking replication.

For rename we need a different logic MDEV-16728 will solve it.
2018-07-18 17:13:24 +05:30
Jan Lindström
312de43f40
Merge pull request #786 from codership/10.1-MDEV-14612
MDEV-14612 wsrep_sst_mariabackup unnecessarily converts address to host name
2018-07-18 10:25:35 +03:00
Oleksandr Byelkin
e5c26fdfab Merge branch '5.5' into bb-10.0-merge 2018-07-17 16:56:21 +02:00
Daniel Black
8c45eb3ea5 MDEV-15050 scripts: mysql_install_db.{sh|pl}, mysqld_multi - mysqld is in @sbindir@
Closes #551
2018-07-16 18:36:28 +02:00
Jan Lindström
e08ddccc35
Merge pull request #793 from codership/10.1-MDEV-15442
MDEV-15442 xtrabackup-v2 SST donor stuck in DONOR/DESYNCED state when…
2018-07-16 12:22:36 +03:00
Jan Lindström
fe9f2f4bb6 MDEV-16401: Apply review comments to MDEV-16005
Do not hold LOCK_thd_data during my_error or WSREP_DEBUG. Similarly,
release LOCK_thd_data before close_thread_tables() call.
2018-07-16 08:53:40 +03:00
Igor Babaev
b75d819604 MDEV-16711 Crash in Field_blob::store() while reading statistics
for the small InnoDB table

This bug was introduced by the patch 6c414fcf89.
The patch has not taken into account that some objects of the Field_* types
are created only for TABLE_SHARE and the field 'table' is set to NULL
for them. In particular such are objects created to store statistical
min/max values for columns.
2018-07-15 18:40:25 -07:00
Igor Babaev
ae0eb507bd MDEV-16760 CREATE OR REPLACE TABLE never updates statistical tables
If the command CREATE OR REPLACE TABLE really replaces a table then
it should remove all data on this table from all statistical tables.
2018-07-15 16:28:39 -07:00
Igor Babaev
095dc81158 MDEV-16757 Memory leak after adding manually min/max statistical data
for blob column

ANALYZE TABLE <table> does not collect statistical data on min/max values
for BLOB columns of <table>. However these values can be added into
mysql.column_stats manually by executing proper statements.
Unfortunately this led to a memory leak because the memory allocated
for these values was never freed.
This patch provides the server with a function to free memory allocated
for min/max statistical values of BLOB types.

Temporarily changed the test case until MDEV-16711 is fixed as without
this fix the test case for MDEV-16757 did not fail only for 10.0.
2018-07-15 16:24:24 -07:00
Igor Babaev
1fd84f9129 MDEV-16760 CREATE OR REPLACE TABLE never updates statistical tables
If the command CREATE OR REPLACE TABLE really replaces a table then
it should remove all data on this table from all statistical tables.
2018-07-13 23:03:57 -07:00
Igor Babaev
c89bb15c31 MDEV-16757 Memory leak after adding manually min/max statistical data
for blob column

ANALYZE TABLE <table> does not collect statistical data on min/max values
for BLOB columns of <table>. However these values can be added into
mysql.column_stats manually by executing proper statements.
Unfortunately this led to a memory leak because the memory allocated
for these values was never freed.
This patch provides the server with a function to free memory allocated
for min/max statistical values of BLOB types.
2018-07-13 17:48:45 -07:00
Varun Gupta
ad9d1e8c3f MDEV-16552: [10.0] ASAN global-buffer-overflow in is_stat_table / statistics_for_tables_is_needed
Backport the fix f214d36512 to 10.0

   Author: Sergei Golubchik <serg@mariadb.org>
   Date:   Tue Apr 17 00:44:34 2018 +0200

    ASAN error in is_stat_table()

    don't memcmp beyond the first argument's end

    Also: use my_strcasecmp(table_alias_charset), like elsewhere, not memcmp
2018-07-11 15:22:04 +05:30
Sergei Petrunia
2fbf2277ff MDEV-15982: Incorrect results when subquery is materialized
fix_semijoin_strategies_for_picked_join_order() should set
join->sjm_lookup_tables to be a bitmap of tables inside
SJ-Materialization-Lookup nests.
2018-07-11 10:43:38 +03:00
Varun Gupta
24a0a74f5d MDEV-16307: Incorrect results when using BNLH join instead of BNL join with views
In this issue we are using derived_with_keys optimization and we are using these keys to do a hash join which is incorrect.
We cannot create keys for dervied tables whose keyparts have types are of BLOB or TEXT type. TEXT or BLOB  columns can only be
indexed over a specified length.
2018-07-10 13:54:04 +05:30
Vladislav Vaintroub
a2c0376e08 Fix build on non-Windows, broken by 0897a25c0f 2018-07-02 17:45:19 +01:00
Vladislav Vaintroub
8c5d64dafb Post-fix after MDEV-8540 - do not close stdin on Windows.
It is not open.
2018-07-02 15:22:52 +01:00
Vladislav Vaintroub
0897a25c0f MDEV-16596 : Windows - redo log does not work on native 4K sector disks.
Disks with native 4K sectors need 4K alignment and size for  unbuffered IO
(i.e for files opened with FILE_FLAG_NO_BUFFERING)

Innodb opens redo log with FILE_FLAG_NO_BUFFERING, however it always does
512byte IOs. Thus, the IO on 4K native sectors will fail, rendering
Innodb non-functional.

The fix is to check whether OS_FILE_LOG_BLOCK_SIZE is multiple of logical
sector size, and if it is not, reopen the redo log without
FILE_FLAG_NO_BUFFERING flag.
2018-07-02 15:02:31 +01:00
Sergei Petrunia
1d10c9afe0 Post-fix to "Adopt Debian's fix-FTBFS-on-GNU-Hurd.patch", part #2.
"my_snprintf(NULL, 0, ...)" does not follow what snprintf does. Change
the call in wsrep_dump_rbr_buf_with_header to use snprintf (note that
wsrep_dump_rbr_buf was using snprintf all the way).

Fix an off-by-one error in comparison so it actually prints the output
2018-07-02 15:29:22 +03:00
Igor Babaev
90cb721274 MDEV-16603 Crash with set join_cache_level=4
When the definition of the index used for hash join was created
in create_hj_key_for_table() it could cause memory overwrite
due to a bug that led to an underestimation of the number of
the index component.
2018-06-29 22:46:38 -07:00
Sergei Petrunia
36ea82617c Fix a typo a in the commit before the last one
in the "Adopt Debian's fix-FTBFS-on-GNU-Hurd.patch",
DBUG_VOID_RETURN has been used instead of "return"
2018-06-29 18:16:56 +03:00
Vicențiu Ciorbaru
83bf267e0d Fix Internal Compiler Error GCC-6.3.0
Change the float comparison function to use a negated version when
comparing for equality. This actually produces less code when compiling
with optimizations (O3) on.
2018-06-29 14:41:23 +03:00
Sergei Petrunia
f46acd4a3a Adopt Debian's fix-FTBFS-on-GNU-Hurd.patch.
- Took the original patch by Ondrej Sury;
- Applied a fix for a known problem in the patch:
   https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=882062
- Fixed a few other issues
2018-06-29 14:00:00 +03:00