Commit graph

2452 commits

Author SHA1 Message Date
Sergei Golubchik
6bb11efa4a Merge branch '10.2' into 10.3 2019-01-03 13:09:41 +01:00
Sergei Golubchik
67240858b2 Merge branch '10.1' into 10.2 2018-12-30 18:30:29 +01:00
Sergei Golubchik
aeefd26ecb Merge branch '10.0' into 10.1 2018-12-29 23:44:45 +01:00
Sergei Golubchik
a79183b01e correct table name in CHECK failures during ALTER TABLE 2018-12-20 08:06:55 +01:00
Sergei Golubchik
fca44b7c1f MDEV-17909 Problem by MariaDB Update 10.1.32 -> 10.2.19 (Incorrect information in file: .frm)
use frm_version, not mysql_version when parsing frm

In particular, virtual columns are stored according to
frm_version. And CHECK TABLE will overwrite mysql_version
to the current server version, so it cannot correctly
describe frm format.
2018-12-20 08:06:55 +01:00
Varun Gupta
7e606a2d5c MDEV-17589: Stack-buffer-overflow with indexed varchar (utf8) field
Create a new constant MAX_DATA_LENGTH_FOR_KEY.
Replace the value of MAX_KEY_LENGTH to also include the LENGTH and NULL BYTES
of a field.
2018-12-19 10:38:46 +05:30
Varun Gupta
da4efd56aa Backported MDEV-11196(e4d10e09cf) and MDEV-10360(8a8ba1949b) to 10.0 2018-12-19 10:38:29 +05:30
Marko Mäkelä
36359157cf Merge 10.2 into 10.3 2018-11-26 16:49:26 +02:00
Marko Mäkelä
971e1d8677 MDEV-17831 TRUNCATE TABLE removes ROW_FORMAT=COMPRESSED
If a table had a KEY_BLOCK_SIZE attribute, but no ROW_FORMAT,
it would be created as ROW_FORMAT=COMPRESSED in InnoDB.
However, TRUNCATE TABLE would lose the KEY_BLOCK_SIZE attribute
and create the table with the innodb_default_row_format (DYNAMIC).

This is a regression that was introduced by MDEV-13564.

update_create_info_from_table(): Copy also KEY_BLOCK_SIZE.
2018-11-26 16:41:09 +02:00
Sergei Golubchik
9bf8568c04 fix an old typo 2018-11-06 13:36:50 +01:00
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
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
Eugene Kosov
44016ec0ca MDEV-16211 Contents of transaction_registry not replicated by Galera
Patch fixes two bugs:
1) BEGIN_TIMESTAMP of MYSQL.TRANSACTION_REGISTY is '0-0-0' on replication record insertion
2) BEGIN_TIMESTAMP equals COMMMIT_TIMESTAMP in MYSQL.TRANSACTION_REGISTRY

Fixed by calling THD::set_time() at appropriate places
2018-10-01 17:53:20 +03:00
Sergei Golubchik
556f058ab2 ASAN error when strlen(db) < 6 2018-09-28 18:04:26 +02:00
Sergei Golubchik
57e0da50bb Merge branch '10.2' into 10.3 2018-09-28 16:37:06 +02:00
Michael Widenius
bd7c31621f MDEV-17065 Crash on SHOW CREATE TABLE with CHECK CONSTRAINT
The problem was that the original alias was replaced with a new allocated
string, but constraint item's are still pointing to the original alias.

Fixed by storing the original alias used when printing constraint in the
tables mem_root.
2018-09-16 11:23:27 +03:00
Oleksandr Byelkin
28f08d3753 Merge branch '10.1' into 10.2 2018-09-14 08:47:22 +02:00
Oleksandr Byelkin
31081593aa Merge branch '11.0' into 10.1 2018-09-06 22:45:19 +02:00
Sergey Vojtovich
4cf75706b3 MDEV-16757 Memory leak after adding manually min/max statistical data
for blob column

Moved delete_stat_values_for_table_share() call to proper place.
2018-09-05 17:14:20 +04:00
Sergei Golubchik
e81f101dac create a reusable function that tells what FK actions can write
Backport of 794f71cbc4
2018-09-04 09:49:52 +02:00
Sergei Golubchik
22bcfa011a cleanup: FOREIGN_KEY_INFO
instead of returning strings for CASCADE/RESTRICT
from every storage engine, use enum values

Backport of a3614d33e8
2018-09-04 08:37:44 +02:00
Marko Mäkelä
7830fb7f45 Merge 10.2 into 10.3 2018-08-28 12:22:56 +03:00
Igor Babaev
497d86276f MDEV-17017 Explain for query using derived table specified with
a table value constructor shows wrong number of rows

This is another attempt to fix this bug. The previous patch did not take
into account that a transformation for ALL/ANY subqueries could be applied
to the materialized table that wrapped the table value constructor used as
a specification of the subselect used an ALL/ANY subquery. In this case
the result of the derived table used a sink of the class select_subselect
rather than of the class select_unit. Thus the previous fix could cause
memory overwrites when running EXPLAIN for queries with table value
constructors in ALL/ANY subselects.
2018-08-27 08:15:10 -07:00
Sergei Golubchik
5d650d366d MDEV-16961 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed upon concurrent DELETE and DDL with virtual blob column
After iterating all fields and setting PART_INDIRECT_KEY_FLAG as
necessary, TABLE::mark_columns_used_by_virtual_fields() remembers
in TABLE_SHARE that this operation was done and need not be repeated.

But as the flag is set in TABLE_SHARE, PART_INDIRECT_KEY_FLAG must
be set in TABLE_SHARE::field[], not only in TABLE::field[].

Otherwise all new TABLEs opened from this TABLE_SHARE will
never have it.
2018-08-22 22:18:44 +02:00
Sergei Golubchik
0aa9b03393 Merge branch '10.2' into 10.3 2018-08-12 12:02:23 +02:00
Oleksandr Byelkin
affdd79c69 Merge branch '10.1' into 10.2 2018-08-03 23:26:26 +02:00
Marko Mäkelä
05459706f2 Merge 10.2 into 10.3 2018-08-03 15:57:23 +03:00
Oleksandr Byelkin
701f0b8e36 Fix gcc 7.3 compiler warnings. 2018-08-03 14:37:55 +02:00
Marko Mäkelä
ef3070e997 Merge 10.1 into 10.2 2018-08-02 08:19:57 +03:00
Oleksandr Byelkin
0896d7ebc3 Merge branch '10.0' into bb-10.1-merge 2018-07-19 12:55:54 +02:00
Oleksandr Byelkin
e5c26fdfab Merge branch '5.5' into bb-10.0-merge 2018-07-17 16:56:21 +02: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
Marko Mäkelä
186a998b5b Merge 10.2 into 10.3 2018-07-03 10:25:38 +03:00
Anel Husakovic
8639e28808 MDEV-16630: Ambiguous error message when check constraint matches table name
One can create table with the same name for `field` and `table` `check` constraint.
For example:
`create table t(a int check(a>0), constraint a check(a>10));`
But when inserting new rows same error is always raised.
For example with
```insert into t values (-1);```
and
```insert into t values (10);```
same error `ER_CONSTRAINT_FAILED` is obtained and it is not clear which constraint is violated.
This patch solve this error so that in case if field constraint is violated the first parameter
in the error message is `table.field_name` and if table constraint is violated the first parameter
in error message is `constraint_name`.
2018-07-01 22:32:55 +03:00
Sergei Golubchik
36e59752e7 Merge branch '10.2' into 10.3 2018-06-30 16:39:20 +02:00
Aleksey Midenkov
7c0779da7c MDEV-16102 Wrong ER_DUP_ENTRY upon ADD UNIQUE KEY on versioned table
* ignore CHECK constraint for historical rows;
* FOREIGN KEY test case.

TODO:
MDEV-16301 IB: use real table name for error messages on ALTER

Closes tempesta-tech/mariadb#491
Closes #748
2018-06-30 16:12:45 +02:00
Michael Widenius
937c193188 Fixed MDEV-16512, crashing on re-execution of failing SP
MDEV-16512 Server crashes in find_field_in_table_ref on 2nd
execution of SP referring to non-existing field

Problem was in the natural join code that it changed TABLE_LIST and
Item_fields but didn't restore changed things if things goes wrong
and was not able to re-execute after failure.
Some of the problems could have been avoided if we would have run
fix_fields before doing natural join transformations.

Fixed by marking functions complete AFTER they had executed, instead at
start.
I had also to change some tests that checked if Item_fields are usable.

This doesn't fix all known problems, but at least avoids some crashes.
What should be done in the near future is to mark the statement in the SP
as 'not re-executable' and force a reparse of it on next execution.

Reviewer: Sergei Petrunia <psergey@askmonty.org>
2018-06-27 13:41:19 +03:00
Sergei Golubchik
b942aa34c1 Merge branch '10.1' into 10.2 2018-06-21 23:47:39 +02:00
Monty
ab19466656 MDEV-15114 ASAN heap-use-after-free in mem_heap_dup or dfield_data_is_binary_equal
The bug was that innobase_get_computed_value() trashed record[0] and data
in Field_blob::value

Fixed by using a record on the heap for innobase_get_computed_value()

Reviewer: Marko Mäkelä
2018-06-19 16:23:34 +03:00
Monty
831df10981 Add PART_INDIRECT_KEY_FLAG
This is to mark that a field is indirectly part of a key, which simplifes
checking if we need to have this field up to date to evaluate a key.

For example:
CREATE TABLE t1 (a int, b int as (a) virtual,
                 c int as (b) virtual, index(c))
would mark a and b with PART_INDIRECT_KEY_FLAG.
c is marked with PART_KEY_FLAG as before.
2018-06-19 16:23:34 +03:00
Alexander Barkov
f5b128dfad Merge remote-tracking branch 'origin/10.0' into 10.1 2018-06-19 14:04:53 +04:00
Alexander Barkov
c450f7d8d5 Merge remote-tracking branch 'origin/5.5' into 10.0 2018-06-19 14:03:41 +04:00
Alexander Barkov
15b92915ed MDEV-15834 The code in TABLE_SHARE::init_from_binary_frm_image() is not safe 2018-06-19 13:02:02 +04:00
Sergei Golubchik
776fc87686 fix compilation w/o partitioning
followup for d8da920264
2018-06-14 18:06:44 +02:00
Vicențiu Ciorbaru
aa59ecec89 Merge branch '10.0' into 10.1 2018-06-12 18:55:27 +03:00
Vicențiu Ciorbaru
3ead951180 Merge branch '5.5' into 10.0 2018-06-10 17:16:27 +03:00
Varun Gupta
cd33280b68 MDEV-16374: Filtered shows 0 for materilization scan for a semi join, which makes optimizer always picks
materialization scan over materialization lookup

For non-mergeable semi-joins we don't store the estimates of the IN subquery in table->file->stats.records.
In the function TABLE_LIST::fetch_number_of_rows, we store the number of rows in the tables
(estimates in case of derived table/views).
Currently we don't store the estimates for non-mergeable semi-joins, which leads to a problem of selecting
materialization scan over materialization lookup.
Fixed this by storing these estimated appropriately
2018-06-09 11:40:28 +05:30
Oleksandr Byelkin
75b4eb5cc9 Catch of OOM situation. 2018-06-06 15:27:57 +02:00
Alexander Barkov
106f0b5798 MDEV-16385 ROW SP variable is allowed in unexpected context
The problem described in the bug report happened because the code
did not test check_cols(1) after fix_fields() in a few places.

Additionally, fix_fields() could be called multiple times for SP variables,
because they are all fixed at a early stage in append_for_log().

Solution:
1. Adding a few helper methods
   - fix_fields_if_needed()
   - fix_fields_if_needed_for_scalar()
   - fix_fields_if_needed_for_bool()
   - fix_fields_if_needed_for_order_by()
  and using it in many cases instead of fix_fields() where
  the "fixed" status is not definitely known to be "false".

2. Adding DBUG_ASSERT(!fixed) into Item_splocal*::fix_fields()
   to catch double execution.

3. Adding tests.

As a good side effect, the patch removes a lot of duplicate code (~60 lines):

   if (!item->fixed &&
       item->fix_fields(..) &&
       item->check_cols(1))
     return true;
2018-06-05 10:25:39 +04:00
Marko Mäkelä
a3539bbb2a Merge 10.2 into 10.3 2018-05-29 17:34:49 +03:00