Skip to content
Permalink
Browse files
MDEV-29886 Assertion !index->table->is_temporary() failed in CHECK TABLE
ha_innobase::check(): Do not enable READ UNCOMMITTED isolation level
for temporary tables, because it would report index count mismatch
for secondary indexes.

row_check_index(): Ignore EXTENDED for temporary tables, because
the tables are private to the current connection and there will be
no purge of committed transaction history.
  • Loading branch information
dr-m committed Oct 26, 2022
1 parent 8b6a308 commit cf96db4
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
@@ -775,3 +775,18 @@ INSERT INTO t VALUES (1);
START TRANSACTION READ ONLY;
UPDATE t SET a = NULL;
ROLLBACK;
DROP TABLE t;
#
# MDEV-29886 Assertion !index->table->is_temporary() failed
# in trx_undo_prev_version_build upon CHECK
#
CREATE TEMPORARY TABLE t (a INT, KEY(a)) ENGINE=InnoDB SELECT 1;
UPDATE t SET a=2;
CHECK TABLE t;
Table Op Msg_type Msg_text
test.t check status OK
CHECK TABLE t EXTENDED;
Table Op Msg_type Msg_text
test.t check status OK
DROP TEMPORARY TABLE t;
# End of 10.6 tests
@@ -613,3 +613,15 @@ INSERT INTO t VALUES (1);
START TRANSACTION READ ONLY;
UPDATE t SET a = NULL;
ROLLBACK;
DROP TABLE t;

--echo #
--echo # MDEV-29886 Assertion !index->table->is_temporary() failed
--echo # in trx_undo_prev_version_build upon CHECK
--echo #
CREATE TEMPORARY TABLE t (a INT, KEY(a)) ENGINE=InnoDB SELECT 1;
UPDATE t SET a=2;
CHECK TABLE t;
CHECK TABLE t EXTENDED;
DROP TEMPORARY TABLE t;
--echo # End of 10.6 tests
@@ -15220,6 +15220,7 @@ ha_innobase::check(
of records in some index; to play safe, we normally use
REPEATABLE READ here */
m_prebuilt->trx->isolation_level = high_level_read_only
&& !m_prebuilt->table->is_temporary()
? TRX_ISO_READ_UNCOMMITTED
: TRX_ISO_REPEATABLE_READ;

@@ -6228,6 +6228,7 @@ dberr_t row_check_index(row_prebuilt_t *prebuilt, ulint *n_rows)
ReadView check_table_extended_view;
ReadView &view=
prebuilt->need_to_access_clustered &&
!prebuilt->table->is_temporary() &&
prebuilt->trx->isolation_level != TRX_ISO_READ_UNCOMMITTED
? check_table_extended_view : prebuilt->trx->read_view;
if (&view == &check_table_extended_view)

0 comments on commit cf96db4

Please sign in to comment.