diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2018-09-19 17:46:58 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2018-09-19 17:46:58 +0300 |
commit | 4fb39f1d033cc1f12178e7f8c7709c6fa492866c (patch) | |
tree | 1b3f2d864c59038187773b8f626f8782d82efdf2 | |
parent | fc491b24938bbab7c18b98aa168a94456911da43 (diff) | |
parent | 45eaed0c4c8ce4319100a960852fa7dc9c13e3c6 (diff) | |
download | mariadb-git-4fb39f1d033cc1f12178e7f8c7709c6fa492866c.tar.gz |
Merge 10.4 into 10.4-mdev-15662
-rw-r--r-- | mysql-test/suite/innodb/include/alter_nocopy.inc | 6 | ||||
-rw-r--r-- | mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff | 6 | ||||
-rw-r--r-- | mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff | 6 | ||||
-rw-r--r-- | mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff | 6 | ||||
-rw-r--r-- | mysql-test/suite/innodb/r/alter_algorithm.result | 6 | ||||
-rwxr-xr-x | storage/innobase/handler/handler0alter.cc | 18 | ||||
-rw-r--r-- | storage/innobase/include/row0mysql.h | 2 | ||||
-rw-r--r-- | storage/innobase/include/trx0rec.h | 6 | ||||
-rw-r--r-- | storage/innobase/row/row0purge.cc | 10 | ||||
-rw-r--r-- | storage/innobase/row/row0uins.cc | 8 | ||||
-rw-r--r-- | storage/innobase/row/row0undo.cc | 2 | ||||
-rw-r--r-- | storage/innobase/trx/trx0rec.cc | 6 | ||||
-rw-r--r-- | storage/innobase/trx/trx0roll.cc | 2 |
13 files changed, 45 insertions, 39 deletions
diff --git a/mysql-test/suite/innodb/include/alter_nocopy.inc b/mysql-test/suite/innodb/include/alter_nocopy.inc index 6b19d244bd9..00cab8c47e5 100644 --- a/mysql-test/suite/innodb/include/alter_nocopy.inc +++ b/mysql-test/suite/innodb/include/alter_nocopy.inc @@ -14,16 +14,16 @@ SELECT @@alter_algorithm; --enable_info --error $error_code ---eval ALTER TABLE t1 ADD INDEX idx1(f4) +--eval ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1 --error $error_code ---eval ALTER TABLE t1 DROP INDEX idx +--eval ALTER TABLE t1 DROP INDEX idx, page_compression_level=5 --error $error_code --eval ALTER TABLE t1 ADD UNIQUE INDEX u1(f2) --error $error_code ---eval ALTER TABLE t1 DROP INDEX f4 +--eval ALTER TABLE t1 DROP INDEX f4, page_compression_level=9 SET foreign_key_checks = 0; --error $error_code diff --git a/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff b/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff index e9a24820a50..8178e9ea58e 100644 --- a/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff +++ b/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff @@ -70,12 +70,12 @@ @@alter_algorithm -COPY +INPLACE - ALTER TABLE t1 ADD INDEX idx1(f4); + ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1; -affected rows: 1 -info: Records: 1 Duplicates: 0 Warnings: 0 +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 - ALTER TABLE t1 DROP INDEX idx; + ALTER TABLE t1 DROP INDEX idx, page_compression_level=5; -affected rows: 1 -info: Records: 1 Duplicates: 0 Warnings: 0 +affected rows: 0 @@ -85,7 +85,7 @@ -info: Records: 1 Duplicates: 0 Warnings: 0 +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 - ALTER TABLE t1 DROP INDEX f4; + ALTER TABLE t1 DROP INDEX f4, page_compression_level=9; -affected rows: 1 -info: Records: 1 Duplicates: 0 Warnings: 0 +affected rows: 0 diff --git a/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff b/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff index c432494dd53..ce2e240bb35 100644 --- a/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff +++ b/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff @@ -61,11 +61,11 @@ @@alter_algorithm -COPY +INSTANT - ALTER TABLE t1 ADD INDEX idx1(f4); + ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1; -affected rows: 1 -info: Records: 1 Duplicates: 0 Warnings: 0 +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY - ALTER TABLE t1 DROP INDEX idx; + ALTER TABLE t1 DROP INDEX idx, page_compression_level=5; -affected rows: 1 -info: Records: 1 Duplicates: 0 Warnings: 0 +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: DROP INDEX. Try ALGORITHM=NOCOPY @@ -73,7 +73,7 @@ -affected rows: 1 -info: Records: 1 Duplicates: 0 Warnings: 0 +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY - ALTER TABLE t1 DROP INDEX f4; + ALTER TABLE t1 DROP INDEX f4, page_compression_level=9; -affected rows: 1 -info: Records: 1 Duplicates: 0 Warnings: 0 +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: DROP INDEX. Try ALGORITHM=NOCOPY diff --git a/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff b/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff index 3ec1eed2e3b..5d462e0012d 100644 --- a/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff +++ b/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff @@ -61,12 +61,12 @@ @@alter_algorithm -COPY +NOCOPY - ALTER TABLE t1 ADD INDEX idx1(f4); + ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1; -affected rows: 1 -info: Records: 1 Duplicates: 0 Warnings: 0 +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 - ALTER TABLE t1 DROP INDEX idx; + ALTER TABLE t1 DROP INDEX idx, page_compression_level=5; -affected rows: 1 -info: Records: 1 Duplicates: 0 Warnings: 0 +affected rows: 0 @@ -76,7 +76,7 @@ -info: Records: 1 Duplicates: 0 Warnings: 0 +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 - ALTER TABLE t1 DROP INDEX f4; + ALTER TABLE t1 DROP INDEX f4, page_compression_level=9; -affected rows: 1 -info: Records: 1 Duplicates: 0 Warnings: 0 +affected rows: 0 diff --git a/mysql-test/suite/innodb/r/alter_algorithm.result b/mysql-test/suite/innodb/r/alter_algorithm.result index 9a031d9066a..cbefcad5986 100644 --- a/mysql-test/suite/innodb/r/alter_algorithm.result +++ b/mysql-test/suite/innodb/r/alter_algorithm.result @@ -59,16 +59,16 @@ INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4); SELECT @@alter_algorithm; @@alter_algorithm COPY -ALTER TABLE t1 ADD INDEX idx1(f4); +ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1; affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 -ALTER TABLE t1 DROP INDEX idx; +ALTER TABLE t1 DROP INDEX idx, page_compression_level=5; affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 ALTER TABLE t1 ADD UNIQUE INDEX u1(f2); affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 -ALTER TABLE t1 DROP INDEX f4; +ALTER TABLE t1 DROP INDEX f4, page_compression_level=9; affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 SET foreign_key_checks = 0; diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index d115401a0a8..a6c6e656ef8 100755 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -110,20 +110,23 @@ static const alter_table_operations INNOBASE_FOREIGN_OPERATIONS = ALTER_DROP_FOREIGN_KEY | ALTER_ADD_FOREIGN_KEY; +/** Operations that InnoDB cares about and can perform without creating data */ +static const alter_table_operations INNOBASE_ALTER_NOCREATE + = ALTER_DROP_NON_UNIQUE_NON_PRIM_INDEX + | ALTER_DROP_UNIQUE_INDEX; + /** Operations that InnoDB cares about and can perform without rebuild */ static const alter_table_operations INNOBASE_ALTER_NOREBUILD = INNOBASE_ONLINE_CREATE - | ALTER_DROP_NON_UNIQUE_NON_PRIM_INDEX - | ALTER_DROP_UNIQUE_INDEX -#ifdef MYSQL_RENAME_INDEX - | ALTER_RENAME_INDEX -#endif - ; + | INNOBASE_ALTER_NOCREATE; /** Operations that can be performed instantly, without inplace_alter_table() */ static const alter_table_operations INNOBASE_ALTER_INSTANT = ALTER_VIRTUAL_COLUMN_ORDER | ALTER_COLUMN_NAME +#ifdef MYSQL_RENAME_INDEX + | ALTER_RENAME_INDEX +#endif | ALTER_ADD_VIRTUAL_COLUMN | INNOBASE_FOREIGN_OPERATIONS | ALTER_COLUMN_EQUAL_PACK_LENGTH @@ -560,6 +563,7 @@ innobase_need_rebuild( const TABLE* table) { if ((ha_alter_info->handler_flags & ~(INNOBASE_INPLACE_IGNORE + | INNOBASE_ALTER_NOREBUILD | INNOBASE_ALTER_INSTANT)) == ALTER_OPTIONS) { return alter_options_need_rebuild(ha_alter_info, table); @@ -7062,6 +7066,7 @@ err_exit: if (!(ha_alter_info->handler_flags & INNOBASE_ALTER_DATA) || ((ha_alter_info->handler_flags & ~(INNOBASE_INPLACE_IGNORE + | INNOBASE_ALTER_NOCREATE | INNOBASE_ALTER_INSTANT)) == ALTER_OPTIONS && !alter_options_need_rebuild(ha_alter_info, table))) { @@ -7347,6 +7352,7 @@ ok_exit: } if ((ha_alter_info->handler_flags & ~(INNOBASE_INPLACE_IGNORE + | INNOBASE_ALTER_NOCREATE | INNOBASE_ALTER_INSTANT)) == ALTER_OPTIONS && !alter_options_need_rebuild(ha_alter_info, table)) { diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h index c38f94f5e73..96454995e74 100644 --- a/storage/innobase/include/row0mysql.h +++ b/storage/innobase/include/row0mysql.h @@ -688,7 +688,7 @@ struct row_prebuilt_t { to the Innobase format from the MySQL format */ const byte* default_rec; /*!< the default values of all columns - (a "metadata") in MySQL format */ + (a "default row") in MySQL format */ ulint hint_need_to_fetch_extra_cols; /*!< normally this is set to 0; if this is set to ROW_RETRIEVE_PRIMARY_KEY, diff --git a/storage/innobase/include/trx0rec.h b/storage/innobase/include/trx0rec.h index 88c98625462..563d31e1a25 100644 --- a/storage/innobase/include/trx0rec.h +++ b/storage/innobase/include/trx0rec.h @@ -311,7 +311,7 @@ compilation info multiplied by 16 is ORed to this value in an undo log record */ #define TRX_UNDO_RENAME_TABLE 9 /*!< RENAME TABLE */ -#define TRX_UNDO_INSERT_DEFAULT 10 /*!< insert a "default value" +#define TRX_UNDO_INSERT_METADATA 10 /*!< insert a metadata pseudo-record for instant ALTER */ #define TRX_UNDO_INSERT_REC 11 /* fresh insert into clustered index */ #define TRX_UNDO_UPD_EXIST_REC 12 /* update of a non-delete-marked @@ -328,8 +328,8 @@ record */ storage fields: used by purge to free the external storage */ -/** The search tuple corresponding to TRX_UNDO_INSERT_DEFAULT */ -extern const dtuple_t trx_undo_default_rec; +/** The search tuple corresponding to TRX_UNDO_INSERT_METADATA */ +extern const dtuple_t trx_undo_metadata; #include "trx0rec.ic" diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc index 10931723e93..95ecd6611f6 100644 --- a/storage/innobase/row/row0purge.cc +++ b/storage/innobase/row/row0purge.cc @@ -1044,7 +1044,7 @@ row_purge_parse_undo_rec( switch (type) { case TRX_UNDO_RENAME_TABLE: return false; - case TRX_UNDO_INSERT_DEFAULT: + case TRX_UNDO_INSERT_METADATA: case TRX_UNDO_INSERT_REC: break; default: @@ -1081,7 +1081,7 @@ try_again: } switch (type) { - case TRX_UNDO_INSERT_DEFAULT: + case TRX_UNDO_INSERT_METADATA: case TRX_UNDO_INSERT_REC: break; default: @@ -1119,8 +1119,8 @@ err_exit: return(false); } - if (type == TRX_UNDO_INSERT_DEFAULT) { - node->ref = &trx_undo_default_rec; + if (type == TRX_UNDO_INSERT_METADATA) { + node->ref = &trx_undo_metadata; return(true); } @@ -1187,7 +1187,7 @@ row_purge_record_func( MONITOR_INC(MONITOR_N_DEL_ROW_PURGE); } break; - case TRX_UNDO_INSERT_DEFAULT: + case TRX_UNDO_INSERT_METADATA: case TRX_UNDO_INSERT_REC: node->roll_ptr |= 1ULL << ROLL_PTR_INSERT_FLAG_POS; /* fall through */ diff --git a/storage/innobase/row/row0uins.cc b/storage/innobase/row/row0uins.cc index a5d7294c9ed..d610e45edbc 100644 --- a/storage/innobase/row/row0uins.cc +++ b/storage/innobase/row/row0uins.cc @@ -227,7 +227,7 @@ retry: func_exit: btr_pcur_commit_specify_mtr(&node->pcur, &mtr); - if (err == DB_SUCCESS && node->rec_type == TRX_UNDO_INSERT_DEFAULT) { + if (err == DB_SUCCESS && node->rec_type == TRX_UNDO_INSERT_METADATA) { /* When rolling back the very first instant ADD COLUMN operation, reset the root page to the basic state. */ ut_ad(!index->table->is_temporary()); @@ -422,7 +422,7 @@ row_undo_ins_parse_undo_rec( default: ut_ad(!"wrong undo record type"); goto close_table; - case TRX_UNDO_INSERT_DEFAULT: + case TRX_UNDO_INSERT_METADATA: case TRX_UNDO_INSERT_REC: break; case TRX_UNDO_RENAME_TABLE: @@ -464,7 +464,7 @@ close_table: ptr, clust_index, &node->ref, node->heap); } else { - node->ref = &trx_undo_default_rec; + node->ref = &trx_undo_metadata; } if (!row_undo_search_clust_to_pcur(node)) { @@ -596,7 +596,7 @@ row_undo_ins( } /* fall through */ - case TRX_UNDO_INSERT_DEFAULT: + case TRX_UNDO_INSERT_METADATA: log_free_check(); if (node->table->id == DICT_INDEXES_ID) { diff --git a/storage/innobase/row/row0undo.cc b/storage/innobase/row/row0undo.cc index a85b817d5cb..2c261c5b9d3 100644 --- a/storage/innobase/row/row0undo.cc +++ b/storage/innobase/row/row0undo.cc @@ -236,7 +236,7 @@ row_undo_search_clust_to_pcur( clust_index, node->update, node->heap); } else { ut_ad((node->row->info_bits == REC_INFO_MIN_REC_FLAG) - == (node->rec_type == TRX_UNDO_INSERT_DEFAULT)); + == (node->rec_type == TRX_UNDO_INSERT_METADATA)); node->undo_row = NULL; node->undo_ext = NULL; } diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc index 99fa648512b..eb235547585 100644 --- a/storage/innobase/trx/trx0rec.cc +++ b/storage/innobase/trx/trx0rec.cc @@ -40,8 +40,8 @@ Created 3/26/1996 Heikki Tuuri #include "fsp0sysspace.h" #include "row0mysql.h" -/** The search tuple corresponding to TRX_UNDO_INSERT_DEFAULT. */ -const dtuple_t trx_undo_default_rec = { +/** The search tuple corresponding to TRX_UNDO_INSERT_METADATA. */ +const dtuple_t trx_undo_metadata = { /* This also works for REC_INFO_METADATA_ALTER, because the delete-mark (REC_INFO_DELETED_FLAG) is ignored when searching. */ REC_INFO_METADATA_ADD, @@ -513,7 +513,7 @@ trx_undo_page_report_insert( ut_ad(index->is_instant()); ut_ad(undo_block->frame[first_free + 2] == TRX_UNDO_INSERT_REC); - undo_block->frame[first_free + 2] = TRX_UNDO_INSERT_DEFAULT; + undo_block->frame[first_free + 2] = TRX_UNDO_INSERT_METADATA; goto done; } diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc index c0864e40622..f7f6dff4380 100644 --- a/storage/innobase/trx/trx0roll.cc +++ b/storage/innobase/trx/trx0roll.cc @@ -1019,7 +1019,7 @@ trx_roll_pop_top_rec_of_trx(trx_t* trx, roll_ptr_t* roll_ptr, mem_heap_t* heap) trx_undo_rec_t* undo_rec = trx_roll_pop_top_rec(trx, undo, &mtr); const undo_no_t undo_no = trx_undo_rec_get_undo_no(undo_rec); switch (trx_undo_rec_get_type(undo_rec)) { - case TRX_UNDO_INSERT_DEFAULT: + case TRX_UNDO_INSERT_METADATA: /* This record type was introduced in MDEV-11369 instant ADD COLUMN, which was implemented after MDEV-12288 removed the insert_undo log. There is no |