summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2021-11-12 00:36:05 +0100
committerVladislav Vaintroub <wlad@mariadb.com>2021-11-12 00:36:05 +0100
commit5566cbadb03856aba9c236b131f544490cd2bee4 (patch)
tree3115010fde89b0a6e29ddd9b1aba64d1a0702842
parentbc57ff7cf79504a198d4752b4748340a4afd886c (diff)
parentd9a5c5db072e58cc21d462d107f9e018329011a4 (diff)
downloadmariadb-git-5566cbadb03856aba9c236b131f544490cd2bee4.tar.gz
Merge branch '10.7' into 10.8
-rw-r--r--mysql-test/suite/innodb/r/import_bugs.result8
-rw-r--r--mysql-test/suite/innodb/t/import_bugs.test9
-rw-r--r--storage/innobase/fsp/fsp0fsp.cc13
-rw-r--r--storage/innobase/row/row0mysql.cc4
-rw-r--r--storage/myisam/mi_delete.c8
5 files changed, 27 insertions, 15 deletions
diff --git a/mysql-test/suite/innodb/r/import_bugs.result b/mysql-test/suite/innodb/r/import_bugs.result
index a52fe6abbd6..14e4954e79f 100644
--- a/mysql-test/suite/innodb/r/import_bugs.result
+++ b/mysql-test/suite/innodb/r/import_bugs.result
@@ -10,3 +10,11 @@ ALTER TABLE imp_t1 IMPORT TABLESPACE;
ERROR HY000: Schema mismatch (ROW_FORMAT mismatch)
DROP TABLE imp_t1, t1;
SET GLOBAL innodb_checksum_algorithm=@save_innodb_checksum_algorithm;
+#
+# MDEV-27006 Assertion `!lock_trx_has_sys_table_locks(trx)' --echo # failed in dberr_t row_discard_tablespace_for_mysql
+# (dict_table_t*, trx_t*)
+CREATE TABLE t1 (c INT KEY) ENGINE=INNODB;
+CREATE TABLE t2 (c INT KEY,FOREIGN KEY(c) REFERENCES t1 (c)) ENGINE=INNODB;
+ALTER TABLE t1 DISCARD TABLESPACE;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
+DROP TABLE t2, t1;
diff --git a/mysql-test/suite/innodb/t/import_bugs.test b/mysql-test/suite/innodb/t/import_bugs.test
index 4b5c04e3056..9898d11fc80 100644
--- a/mysql-test/suite/innodb/t/import_bugs.test
+++ b/mysql-test/suite/innodb/t/import_bugs.test
@@ -18,3 +18,12 @@ DROP TABLE imp_t1, t1;
--remove_file $datadir/test/imp_t1.ibd
SET GLOBAL innodb_checksum_algorithm=@save_innodb_checksum_algorithm;
+
+--echo #
+--echo # MDEV-27006 Assertion `!lock_trx_has_sys_table_locks(trx)' --echo # failed in dberr_t row_discard_tablespace_for_mysql
+--echo # (dict_table_t*, trx_t*)
+CREATE TABLE t1 (c INT KEY) ENGINE=INNODB;
+CREATE TABLE t2 (c INT KEY,FOREIGN KEY(c) REFERENCES t1 (c)) ENGINE=INNODB;
+--error ER_ROW_IS_REFERENCED_2
+ALTER TABLE t1 DISCARD TABLESPACE;
+DROP TABLE t2, t1;
diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc
index a2afacc99f2..71685f42c6f 100644
--- a/storage/innobase/fsp/fsp0fsp.cc
+++ b/storage/innobase/fsp/fsp0fsp.cc
@@ -1709,18 +1709,7 @@ fseg_create(fil_space_t *space, ulint byte_offset, mtr_t *mtr,
mtr->x_lock_space(space);
ut_d(space->modify_check(*mtr));
- if (block) {
- ut_ad(block->page.id().space() == space->id);
-
- if (!space->full_crc32()) {
- fil_block_check_type(*block, block->page.id()
- == page_id_t(TRX_SYS_SPACE,
- TRX_SYS_PAGE_NO)
- ? FIL_PAGE_TYPE_TRX_SYS
- : FIL_PAGE_TYPE_SYS,
- mtr);
- }
- }
+ ut_ad(!block || block->page.id().space() == space->id);
if (!has_done_reservation
&& !fsp_reserve_free_extents(&n_reserved, space, 2,
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index 3defc0dbeac..746d1a850b2 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -2495,6 +2495,7 @@ rollback:
fts_optimize_add_table(table);
}
trx->rollback();
+ row_mysql_unlock_data_dictionary(trx);
return err;
}
}
@@ -2508,10 +2509,7 @@ rollback:
err= row_discard_tablespace_foreign_key_checks(trx, table);
if (err != DB_SUCCESS)
- {
- row_mysql_unlock_data_dictionary(trx);
goto rollback;
- }
/* Note: The following cannot be rolled back. Rollback would see the
UPDATE of SYS_INDEXES.TABLE_ID as two operations: DELETE and INSERT.
diff --git a/storage/myisam/mi_delete.c b/storage/myisam/mi_delete.c
index 2c829fa9860..62409a15a46 100644
--- a/storage/myisam/mi_delete.c
+++ b/storage/myisam/mi_delete.c
@@ -767,6 +767,10 @@ err:
returns how many chars was removed or 0 on error
*/
+#if defined(_MSC_VER) && defined(_M_X64) && _MSC_VER >= 1930
+#pragma optimize("g", off)
+#endif
+
static uint remove_key(MI_KEYDEF *keyinfo, uint nod_flag,
uchar *keypos, /* Where key starts */
uchar *lastkey, /* key to be removed */
@@ -891,3 +895,7 @@ static uint remove_key(MI_KEYDEF *keyinfo, uint nod_flag,
(uint) (page_end-start-s_length));
DBUG_RETURN((uint) s_length);
} /* remove_key */
+
+#if defined(_MSC_VER) && defined(_M_X64) && _MSC_VER >= 1930
+#pragma optimize("",on)
+#endif