Commit 45eaed0c authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.3 into 10.4

parents 4a246fec 90b292ce
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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;
......
......@@ -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
......@@ -550,6 +553,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);
......@@ -6836,6 +6840,7 @@ ha_innobase::prepare_inplace_alter_table(
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))) {
......@@ -7121,6 +7126,7 @@ ha_innobase::inplace_alter_table(
}
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)) {
......
......@@ -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,
......
......@@ -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"
......
......@@ -1043,7 +1043,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:
......@@ -1080,7 +1080,7 @@ row_purge_parse_undo_rec(
}
switch (type) {
case TRX_UNDO_INSERT_DEFAULT:
case TRX_UNDO_INSERT_METADATA:
case TRX_UNDO_INSERT_REC:
break;
default:
......@@ -1118,8 +1118,8 @@ row_purge_parse_undo_rec(
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);
}
......@@ -1186,7 +1186,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 */
......
......@@ -227,7 +227,7 @@ row_undo_ins_remove_clust_rec(
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 @@ row_undo_ins_parse_undo_rec(
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) {
......
......@@ -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;
}
......
......@@ -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 = {
REC_INFO_METADATA, 0, 0,
NULL, 0, NULL,
UT_LIST_NODE_T(dtuple_t)()
......@@ -510,7 +510,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;
}
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment