Commit graph

4491 commits

Author SHA1 Message Date
Marko Mäkelä
4bbd8be482 Merge 10.1 into 10.2 2019-06-12 10:30:01 +03:00
Eugene Kosov
e68d3e4557 test commit 2019-06-11 15:50:44 +03:00
Alexander Barkov
f42bda6d75 MDEV-19727 Add Type_handler::Key_part_spec_init_ft 2019-06-11 07:54:37 +04:00
Kentoku SHIBA
be5c432a42
MDEV-16249 CHECKSUM TABLE for a spider table is not parallel and saves all data in memory in the spider head by default (#1328)
add checksum_null for setting null value of checksum
2019-06-11 00:25:08 +09:00
Alexander Barkov
5a19908b95 MDEV-19653 Add class Sql_cmd_create_table 2019-05-31 16:22:53 +04:00
Alexander Barkov
f021317ae1 MDEV-19612 Split ALTER related data type specific code in sql_table.cc to Type_handler 2019-05-28 15:50:11 +04:00
Alexander Barkov
d1d6fe9abf Using more of Sql_mode_save. Adding a similar class for THD::abort_on_warnings. 2019-05-28 10:26:08 +04:00
Marko Mäkelä
826f9d4f7e Merge 10.4 into 10.5 2019-05-23 10:32:21 +03:00
Monty
043a3a0176 Avoid not needed renames in ALTER TABLE
Removed not needed table renames when doing ALTER TABLE when engine
changes and both of the following is true:
- Either new or old engine does not store the table in files
- Neither old or new engine uses files from another engine

We also skip renames when ALTER TABLE does an explicit rename

This improves performance, especially for engines where rename is
a slow operation (like the upcoming S3 engine)
2019-05-23 01:20:18 +03:00
Monty
007f68c37f Replace ha_notify_table_changed() with notify_tabledef_changed()
Reason for the change was that ha_notify_table_changed() was done
after table open when .frm had been replaced, which caused failure
in engines that checks on open if .frm matches the engines table
definition.

Other changes:
- Remove not needed open/close call at end of inline alter table.
  Some test that depended on the table beeing in the table cache after
  ALTER TABLE had to be updated.
2019-05-23 01:20:18 +03:00
Monty
e533ba9b84 Renamed tmp file using #sql_#_# to #sql-#-#
This was done to match the naming of the ALTER #sql-#-# tmp files
2019-05-23 01:20:18 +03:00
Monty
ebf372ddae Indentation cleanups 2019-05-23 01:20:17 +03:00
Eugene Kosov
fae1319450 MDEV-19524 Server crashes in Bitmap<64u>::is_clear_all / Field_longstr::csinfo_change_allows_instant_alter
compare_keys_but_name(): reorder checks to ensure that
new_field->field != NULL inside Field::is_equal()
2019-05-21 08:09:19 +04:00
Oleksandr Byelkin
c07325f932 Merge branch '10.3' into 10.4 2019-05-19 20:55:37 +02:00
Marko Mäkelä
be85d3e61b Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
Marko Mäkelä
26a14ee130 Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
Oleksandr Byelkin
c51f85f882 Merge branch '10.2' into 10.3 2019-05-12 17:20:23 +02:00
Vicențiu Ciorbaru
cb248f8806 Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
Vicențiu Ciorbaru
5543b75550 Update FSF Address
* Update wrong zip-code
2019-05-11 21:29:06 +03:00
Marko Mäkelä
b2f3755c8e Merge 10.1 into 10.2 2019-05-10 08:02:21 +03:00
Sergey Vojtovich
d0b73fb8d3 MDEV-16060 - InnoDB: Failing assertion: ut_strcmp(index->name, key->name)
A sequel to 9180e86 and 149b754.

ALTER TABLE ... ADD FOREIGN KEY may crash if parent table is updated
concurrently.

Block FK parent table updates even earlier, before intermediate child
table is created.

Use proper charset info for my_casedn_str() and don't update original
identifiers so that lower_cast_table_names == 2 is honoured.
2019-05-09 11:13:44 +04:00
Sergei Golubchik
ffb83ba650 cleanup: move checksum code to handler class
make live checksum to be returned in handler::info(),
and slow table-scan checksum to be calculated in handler::checksum().

part of
MDEV-16249 CHECKSUM TABLE for a spider table is not parallel and saves all data in memory in the spider head by default
2019-05-07 18:40:36 +02: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
Sergei Golubchik
5023e465a9 copy-paste error fixed
thanks @FaramosCZ
2019-04-07 15:49:30 +02: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
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ä
5c3ff5cb93 Merge 10.3 into 10.4 2019-04-02 11:04:54 +03:00
Sergei Golubchik
4e1d3f83b7 Merge branch '10.2' into 10.3 2019-03-29 19:41:41 +01:00
Sergei Golubchik
f2a0c758da Merge branch '10.1' into 10.2 2019-03-29 10:58:20 +01:00
Marko Mäkelä
514b305dfb Merge 10.3 into 10.4
The MDEV-17262 commit 26432e49d3
was skipped. In Galera 4, the implementation would seem to require
changes to the streaming replication.

In the tests archive.rnd_pos main.profiling, disable_ps_protocol
for SHOW STATUS and SHOW PROFILE commands until MDEV-18974
has been fixed.
2019-03-20 10:41:32 +02:00
Sergei Golubchik
b64fde8f38 Merge branch '10.2' into 10.3 2019-03-17 13:06:41 +01:00
sachinsetia1001@gmail.com
2e34a031f8 MDEV-18809 Server crash in fields_in_hash_keyinfo or Assertion `key_info->key_part->field->flags & (1<< 30)' failed in setup_keyinfo_hash
Move calling setup_keyinfo_hash until all continue is exhausted.
And also call re_setup_keyinfo_hash for goto err.
2019-03-15 16:05:01 +05:30
sachin
62bfb2fe49 MDEV-18800 Server crash in instant_alter_column_possible or Assertion...
`!pk->has_virtual()' failed in instant_alter_column_possible upon adding key

Hash key can't be primary key.
2019-03-13 15:15:13 +05:30
sachin
560598c9b2 MDEV-18799 Long unique does not work after failed alter table
Restore table->key_info after calling setup_keyinfo_hash in
mysql_prepare_alter_table.
2019-03-13 15:09:16 +05:30
sachin
f9f625fb43 MDEV-18790 Server crash in fields_in_hash_keyinfo after unsuccessful...
attempt to drop BLOB with long index

Restore long table->key_info, So that in the case of unsuccessful table
alter table->key_info should have a correct value. In the case of successful
table alter old table is flushed so that is why we don't see this error in
the case of successful alter.
2019-03-13 13:59:31 +05:30
Marko Mäkelä
e450527938 Merge 10.3 into 10.4 2019-03-12 16:14:31 +02:00
Marko Mäkelä
b32bc70e34 Merge 10.2 into 10.3 2019-03-12 14:26:34 +02:00
Marko Mäkelä
e374755bae Merge 10.1 into 10.2 2019-03-12 13:11:07 +02:00
Sergey Vojtovich
ea52ecbc10 Merge remote-tracking branch 'origin/10.0' into 10.1 2019-03-11 22:50:24 +04:00
Sergey Vojtovich
149b754768 MDEV-17595 - ALTER TABLE ADD FOREIGN KEY crash
ALTER TABLE ... ADD FOREIGN KEY may trigger assertion failure when
it has LOCK=EXCLUSIVE clause or concurrent FLUSH TABLES is being
executed.

In both cases being altered table is marked as flushed, which forces
subsequent attempt to open parent table to re-open. Which in turn is
not allowed while transaction is running.

Rather than opening parent table, just take appropriate MDL lock.

Also removed table_already_fk_prelocked() check: MDL itself has much
better methods to handle duplicate locks. E.g. the former won't acquire
MDL_SHARED_NO_WRITE if it already has MDL_SHARED_READ.
2019-03-11 22:46:12 +04:00
Marko Mäkelä
2a791c53ad Merge 10.3 into 10.4 2019-03-06 09:00:52 +02:00
Marko Mäkelä
a2fc36989e Merge 10.2 into 10.3 2019-03-04 17:01:00 +02:00
Sergei Golubchik
20c89f9f37 MDEV-18712 InnoDB indexes are inconsistent with what defined in .frm for table after rebuilding table with index on blob
when auto-adding a virtual LONG_UNIQUE_HASH_FIELD, fill in
a Virtual_column_info for it, so that fill_alter_inplace_info()
would know we're adding a virtual field (ALTER_ADD_VIRTUAL_COLUMN).
2019-02-27 23:27:43 -05:00
sachin
0477e80522 Long Index is only allowed for unique keys not normal index. 2019-02-27 23:23:18 -05:00
Sergei Golubchik
387b690eab cleanup: cosmetic fixes 2019-02-27 23:15:28 -05:00
Alexander Barkov
cac14b9225 MDEV-17725 Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed in Diagnostics_area::set_ok_status upon ALTER failing due to error from engine 2019-02-26 15:41:27 +04:00
sachin
0372f98cb5 Fix buildbot Windows and bintar compile failure 2019-02-22 12:33:08 +01:00
Sergei Golubchik
bd7f7b1416 MDEV-371 Unique Index for long columns
post-merge fixes
2019-02-22 12:33:08 +01:00
Sergei Golubchik
f6000782fb mysql_prepare_create_table() inconsistency
sql_field->key_length was 0 for blob fields when a field was
being added, but Field_blob::character_octet_length() on
subsequent ALTER TABLE's (when the Field object in the old table
already existed). This means mysql_prepare_create_table() couldn't
reliably detect if the keyseg was a prefix.
2019-02-22 12:32:49 +01:00
Sachin
d00f19e832 MDEV-371 Unique Index for long columns
This patch implements engine independent unique hash index.

Usage:- Unique HASH index can be created automatically for blob/varchar/test column whose key
 length > handler->max_key_length()
or it can be explicitly specified.

  Automatic Creation:-
   Create TABLE t1 (a blob unique);
  Explicit Creation:-
   Create TABLE t1 (a int , unique(a) using HASH);

Internal KEY_PART Representations:-
 Long unique key_info will have 2 representations.
 (lets understand this with an example create table t1(a blob, b blob , unique(a, b)); )

 1. User Given Representation:- key_info->key_part array will be similar to what user has defined.
 So in case of example it will have 2 key_parts (a, b)

 2. Storage Engine Representation:- In this case there will be only one key_part and it will point to
 HASH_FIELD. This key_part will be always after user defined key_parts.

 So:- User Given Representation          [a] [b] [hash_key_part]
                  key_info->key_part ----^
  Storage Engine Representation          [a] [b] [hash_key_part]
                  key_info->key_part ------------^

 Table->s->key_info will have User Given Representation, While table->key_info will have Storage Engine
 Representation.Representation can be changed into each other by calling re/setup_keyinfo_hash function.

Working:-

1. So when user specifies HASH_INDEX or key_length is > handler->max_key_length(), In mysql_prepare_create_table
One extra vfield is added (for each long unique key). And key_info->algorithm is set to HA_KEY_ALG_LONG_HASH.

2. In init_from_binary_frm_image values for hash_keypart is set (like fieldnr , field and flags)

3. In parse_vcol_defs, HASH_FIELD->vcol_info is created. Item_func_hash is used with list of Item_fields,
   When Explicit length is given by user then Item_left is used to concatenate Item_field values.

4. In ha_write_row/ha_update_row check_duplicate_long_entry_key is called which will create the hash key from
table->record[0] and then call ha_index_read_map , if we found duplicated hash , we will compare the result
field by field.
2019-02-22 00:35:40 +01:00
Sergei Golubchik
4386d93500 MDEV-18297 How to reset a forgotten root password
After FLUSH PRIVILEGES remember if the connection started under
--skip-grant-tables and keep it all-powerful, not a lowly anonymous.

One could use this connection to reset passwords as needed.

Also fix a crash in SHOW CREATE USER
2019-02-21 15:04:03 +01:00
Sergei Golubchik
81e4b9b3bb misc cleanups 2019-02-21 14:57:10 +01:00
Nikita Malyavin
6294516a56 MDEV-16975 Application-time periods: ALTER TABLE
* implicit period constraint is hidden and cannot be dropped independently
* create...like and create...select support
2019-02-21 14:57:09 +01:00
Nikita Malyavin
073c93b194 MDEV-17082 Application-time periods: CREATE
* add syntax `CREATE TABLE ... PERIOD FOR <apptime>`
* add table period entity
2019-02-21 14:48:04 +01:00
Oleksandr Byelkin
93ac7ae70f Merge branch '10.3' into 10.4 2019-02-21 14:40:52 +01:00
Marko Mäkelä
2c74799d64 MDEV-18627 Wrong result after instant size change of integer
If we instantly change the size of a fixed-length field
and treat it as kind-of variable-length, then we will need
conversions between old column values and new ones.

I tried adding such a conversion to row_build(), but then I
noticed that more conversions would be needed, because
old values still appeared in a freshly rebuilt secondary index,
causing a mismatch when trying to search with the correct
longer value that was converted in my provisional fix to row_build().

So, we will revert the essential part of
MDEV-15563: Instant ROW_FORMAT=REDUNDANT column extension
(commit 22feb179ae), but not
remove any tests.
2019-02-18 18:30:01 +02:00
Sergei Golubchik
84cbd69c9e cleanup: reformat 2019-02-14 17:30:22 +01:00
Marko Mäkelä
22feb179ae MDEV-15563: Instant ROW_FORMAT=REDUNDANT column extension
This was developed by Aleksey Midenkov based on my design.

In the original InnoDB storage format (that was retroactively named
ROW_FORMAT=REDUNDANT in MySQL 5.0.3), the length of each index field
is stored explicitly.

Because of this, we can and now will allow instant conversion from
VARCHAR to CHAR or VARBINARY to BINARY of equal or greater size,
as well as instant conversion of TINYINT to SMALLINT to MEDIUMINT
to INT to BIGINT (while not changing between signed and unsigned).

Theoretically, we could allow changing from an unsigned integer to
a bigger unsigned integer, as well as changing CHAR to VARCHAR, but
that would require additional metadata and conversions whenever
reading old records.

Field_str::is_equal(), Field_varstring::is_equal(), Field_num::is_equal():
Return the new result IS_EQUAL_PACK_LENGTH_EXT if the table advertises
HA_EXTENDED_TYPES_CONVERSION capability and we are considering the
above-mentioned conversions.

ALTER_COLUMN_EQUAL_PACK_LENGTH_EXT: A new ALTER TABLE flag, similar
to ALTER_COLUMN_EQUAL_PACK_LENGTH but requiring conversions when
reading the data. The Field::is_equal() result IS_EQUAL_PACK_LENGTH_EXT
will map to this flag.

dtype_get_fixed_size_low(): For BINARY, CHAR and integer columns
in ROW_FORMAT=REDUNDANT, return 0 (variable length) from now on.

dtype_get_sql_null_size(): Keep returning the current size for
BINARY, CHAR and integer columns, so that in ROW_FORMAT=REDUNDANT
it will remain possible to update in place between NULL and NOT NULL
values.

btr_index_rec_validate(): Relax a CHECK TABLE length check for
ROW_FORMAT=REDUNDANT tables.

btr_cur_instant_init_low(): No longer trust fixed_len
for ROW_FORMAT=REDUNDANT tables.

We cannot rely on fixed_len anymore because the record can have shorter
length from before instant extension. Note that importing such tablespace
into earlier MariaDB versions produces ER_TABLE_SCHEMA_MISMATCH when
using a .cfg file.
2019-02-13 17:39:05 +02:00
Oleksandr Byelkin
31d6e9c3c8 Fix of error messages with big help of serg 2019-02-12 10:48:19 +01:00
Andrei Elkin
69e552279c merge fixes: sql_table.cc and partition_info.cc (caused by ef4ccb6ce2) done 2019-02-07 17:12:49 +02:00
Oleksandr Byelkin
65c5ef9b49 dirty merge 2019-02-07 13:59:31 +01:00
Marko Mäkelä
e80bcd7f64 Merge 10.3 into 10.4 2019-02-05 12:48:02 +02:00
Alexey Botchkov
f53e795250 MDEV-17599 ALTER TABLE DROP CONSTRAINT does not work for foreign keys.
The list of table constraints doesn't include foreign keys and uniques.
So we replace DROP CONSTRAINT with DROP [FOREIGN] KEY in this case.
2019-02-05 11:24:19 +04:00
Sergei Golubchik
b57ae8b58c MDEV-18239 ASAN use-after-poison in process_str_arg / ... / mark_unsupported_func or unexpected ER_BAD_FIELD_ERROR upon ALTER TABLE
renaming columns in a CHECK constraint during ALTER TABLE
taints the original TABLE and requires m_need_reopen=1.

In this case, though, renaming was redundant, so just don't do it.
2019-02-05 01:34:17 +01:00
Sergei Golubchik
ef4ccb6ce2 MDEV-18083 ASAN heap-use-after-free in Field::set_warning_truncated_wrong_value upon inserting into temporary table
remove TABLE_SHARE::error_table_name() and TABLE_SHARE::orig_table_name
(that was allocated in a wrong memroot in this bug).

instead, simply set TABLE_SHARE::table_name correctly.
2019-02-05 01:34:17 +01:00
Sergei Golubchik
3b7694b7f8 cleanup: don't search for a just-opened tmp table in ALTER
remove thd->find_temporary_table()
2019-02-05 01:34:17 +01:00
Marko Mäkelä
ab2458c61f Merge 10.2 into 10.3 2019-02-04 15:12:14 +02:00
Marko Mäkelä
a249e57b68 Merge 10.1 into 10.2
Temporarily disable a test for
commit 2175bfce3e
because fixing it in 10.2 requires updating libmariadb.
2019-02-03 17:22:05 +02:00
Marko Mäkelä
213ece2f2e Merge 10.1 into 10.1
This is joint work with Oleksandr Byelkin.
2019-02-02 13:00:15 +02:00
Thirunarayanan Balathandayuthapani
b8aef87221 MDEV-16849 Extending indexed VARCHAR column should be instantaneous
Analysis:
========
Increasing the length of the indexed varchar column is not an instant operation for
innodb.

Fix:
===
- Introduce the new handler flag 'Alter_inplace_info::ALTER_COLUMN_INDEX_LENGTH' to
indicate the index length differs due to change of column length changes.

- InnoDB makes the ALTER_COLUMN_INDEX_LENGTH flag as instant operation.

This is a port of Mysql fix.

    commit 913071c0b16cc03e703308250d795bc381627e37
    Author: Nisha Gopalakrishnan <nisha.gopalakrishnan@oracle.com>
    Date:   Wed May 30 14:54:46 2018 +0530

        BUG#26848813: INDEXED COLUMN CAN'T BE CHANGED FROM VARCHAR(15)
                      TO VARCHAR(40) INSTANTANEOUSLY
2019-01-30 15:33:32 +05:30
Sergey Vojtovich
c88fd54d17 Execute bootstrap in main thread
Bootstrap in a separate thread was introduced in 746f0b3b7 to workaround
OS/2 small stack size. OS/2 support was discontinued in 2006 and modern
operating systems have default stack size a few times larger than
default thread_stack and it is tunable.

Aim is to reduce usage of LOCK_thread_count and COND_thread_count.
Part of MDEV-15135.
2019-01-28 17:39:06 +04:00
Sergey Vojtovich
7ad742b265 Simplified code, no functional changes 2019-01-28 17:39:06 +04:00
Oleksandr Byelkin
a3df9bcadc Merge branch '5.5' into 10.0 2019-01-28 10:36:12 +01:00
Sergei Golubchik
38ad46e005 cleanup: fill_alter_inplace_info
remove attempts to track "candidate keys", use what was already
decided in create_table_impl().
2019-01-25 10:06:16 +01:00
Marko Mäkelä
78829a5780 Merge 10.3 into 10.4 2019-01-24 22:42:35 +02:00
Marko Mäkelä
947b6b849d Merge 10.2 into 10.3 2019-01-24 16:14:12 +02:00
Marko Mäkelä
25161e6219 Merge 10.1 into 10.2 2019-01-24 14:43:29 +02:00
Marko Mäkelä
65350042a4 Merge 10.0 into 10.1 2019-01-24 13:24:13 +02:00
Thirunarayanan Balathandayuthapani
a0f3b9f94f MDEV-17376 Server fails to set ADD_PK_INDEX, DROP_PK_INDEX if unique index nominated as PK
Problem:
========
Server fails to notify the engine by not setting the ADD_PK_INDEX and
DROP_PK_INDEX When there is a
 i) Change in candidate for primary key.
 ii) New candidate for primary key.

Fix:
====
Server sets the ADD_PK_INDEX and DROP_PK_INDEX while doing alter for the
above problematic case.
2019-01-24 13:52:51 +05:30
Brave Galera Crew
36a2a185fe Galera4 2019-01-23 15:30:00 +04:00
Oleksandr Byelkin
1ecccb509c MDEV-17085: CHECKSUM TABLE EXTENDED does not work correctly
The problem was in calculating of the mask to clear unused null bits in case of using full byte.
2019-01-16 13:57:22 +01:00
Marko Mäkelä
734510a44d Merge 10.3 into 10.4 2019-01-06 17:43:02 +02:00
Sergei Golubchik
6bb11efa4a Merge branch '10.2' into 10.3 2019-01-03 13:09:41 +01:00
Sergei Golubchik
7b2e2288e9 MDEV-16903 Assertion `!auto_increment_field_not_null' failed in TABLE::init after unsuccessful attempt to add CHECK constraint on temporary table
if the CHECK constraint failed in copy_data_between_tables(),
the loop was aborted prematurely and to->auto_increment_field_not_null
wasn't reset.
2018-12-20 08:06:55 +01:00
Marko Mäkelä
b5763ecd01 Merge 10.3 into 10.4 2018-12-18 11:33:53 +02:00
Marko Mäkelä
45531949ae Merge 10.2 into 10.3 2018-12-18 09:15:41 +02:00
Alexey Botchkov
c4ab352b67 MDEV-14576 Include full name of object in message about incorrect value for column.
The error message modified.
Then the TABLE_SHARE::error_table_name() implementation taken from 10.3,
          to be used as a name of the table in this message.
2018-12-16 02:21:41 +04:00
Marko Mäkelä
c64265f3f9 Merge 10.3 into 10.4 2018-12-12 14:09:48 +02:00
Varun Gupta
8aef7f2bb9 MDEV-17778: Alter table leads to a truncation warning with ANALYZE command
Alter statement changed the THD structure by setting the value to FIELD_CHECK_WARN
and then not resetting it back. This led ANALYZE to throw a warning which previously
it didn't.
2018-12-10 18:27:13 +05:30
Monty
c53aab974b Added syntax and implementation for BACKUP STAGE's
Part of MDEV-5336 Implement LOCK FOR BACKUP

- Changed check of Global_only_lock to also include BACKUP lock.
- We store latest MDL_BACKUP_DDL lock in thd->mdl_backup_ticket to be able
  to downgrade lock during copy_data_between_tables()
2018-12-09 22:12:27 +02:00
Monty
965311ee8b Added new MDL_BACKUP locks for all backup stages
Part of MDEV-5336 Implement LOCK FOR BACKUP

- Added new locks to MDL_BACKUP for all stages of backup locks and
  a new MDL lock needed for backup stages.
- Renamed MDL_BACKUP_STMT to MDL_BACKUP_DDL
- flush_tables() takes a new parameter that decides what should be flushed.
- InnoDB, Aria (transactional tables with checksums), Blackhole, Federated
  and Federatedx tables are marked to be safe for online backup. We are
  using MDL_BACKUP_TRANS_DML instead of MDL_BACKUP_DML locks for these
  which allows any DML's to proceed for these tables during the whole
  backup process until BACKUP STAGE COMMIT which will block the final
  commit.
2018-12-09 22:12:27 +02:00
Monty
f386b70beb Honor lock_wait_timeout when updating stats tables
- Call delete_statistics_tables() after lock_table_names in drop tables.
  This avoids a deadlock issue with FTWRL and future backup locks.
- Added some missing clear_error()
- Ensure we don't clear error caused by the caller
- Updated function comments
2018-12-09 22:12:27 +02:00
Sergey Vojtovich
7a9dfdd8d9 Combine GLOBAL and COMMIT namespaces into BACKUP namespace.
Part of MDEV-5336 Implement LOCK FOR BACKUP

Other things:
- Added printing of MDL locks to DBUG.
2018-12-09 22:12:26 +02:00
Monty
ecdf97924c Fixed that CREATE TABLE code used the right create_info
- The old code used the original create_info from lex, not the new one
  that includes more information (like OPT_OR_REPLACE).
  The bug was not discovered as the code in lock_table_named() only
  checked for OPT_OR_REPLACE in case of timeout errors.
  As lock_table_names will be fixed as part of BACKUP STAGE's, there
  is no changes in lock_table_names() in this commit.
- Removed also the 'temporary' copy of statement flags to thd for
  lock_table_names()
2018-12-09 22:12:25 +02:00
Monty
ae58cd6b87 Simple cleanups (no logic changes) 2018-12-09 20:49:05 +02:00
Alexander Barkov
f89a27b4e5 MDEV-17319 Assertion `ts_type != MYSQL_TIMESTAMP_TIME' failed upon inserting into TIME field 2018-12-02 18:59:04 +04:00