Commit c9b3e453 authored by Monty's avatar Monty

MDEV-11737 Failing assertion: block->magic_n == MEM_BLOCK_MAGIC_N

Issue was that the m_prebuilt array was reused without resetting a counter,
which caused a memory overrun.

Adjusted test case to 79 characters
parent 6c5c9831
......@@ -215,3 +215,13 @@ INDEX(vc(32))
);
DELETE FROM t1 WHERE vc IS NULL ORDER BY pk;
DROP TABLE t1;
#
# MDEV-11737 Failing assertion: block->magic_n == MEM_BLOCK_MAGIC_N
#
CREATE TABLE t1 (i INT PRIMARY KEY, vi INT AS (i*2) VIRTUAL UNIQUE)
ENGINE=InnoDB;
CREATE TABLE t2 (i INT) ENGINE=InnoDB;
ALTER TABLE t1 ADD COLUMN col INT;
SELECT * FROM t1 WHERE vi < 2;
i vi col
DROP TABLE t1, t2;
################################################################################
# t/vcol_keys_innodb.test #
# #
# Purpose: #
# Testing keys, indexes defined upon virtual columns. #
# #
# InnoDB branch #
# #
#------------------------------------------------------------------------------#
# Original Author: Andrey Zhakov #
# Original Date: 2008-09-04 #
# Change Author: #
# Change Date: #
# Change: #
################################################################################
###############################################################################
# t/vcol_keys_innodb.test #
# #
# Purpose: #
# Testing keys, indexes defined upon virtual columns. #
# #
# InnoDB branch #
# #
#-----------------------------------------------------------------------------#
# Original Author: Andrey Zhakov #
# Original Date: 2008-09-04 #
# Change Author: #
# Change Date: #
# Change: #
###############################################################################
#
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
# NOTE: PLEASE DO NOT ADD NOT INNODB SPECIFIC TESTCASES HERE !
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
#------------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
# General not engine specific settings and requirements
--source suite/vcol/inc/vcol_init_vars.pre
#------------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
# Cleanup
--source suite/vcol/inc/vcol_cleanup.inc
#------------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
# Engine specific settings and requirements
##### Storage engine to be tested
......@@ -39,14 +39,25 @@ SET @@session.storage_engine = 'InnoDB';
##### Workarounds for known open engine specific bugs
# none
#------------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
let $with_foreign_keys = 1;
--source suite/vcol/inc/vcol_keys.inc
#------------------------------------------------------------------------------#
# Execute storage engine specific tests
#------------------------------------------------------------------------------#
# Cleanup
--source suite/vcol/inc/vcol_cleanup.inc
#-----------------------------------------------------------------------------#
# Execute storage engine specific tests
#-----------------------------------------------------------------------------#
--echo #
--echo # MDEV-11737 Failing assertion: block->magic_n == MEM_BLOCK_MAGIC_N
--echo #
CREATE TABLE t1 (i INT PRIMARY KEY, vi INT AS (i*2) VIRTUAL UNIQUE)
ENGINE=InnoDB;
CREATE TABLE t2 (i INT) ENGINE=InnoDB;
ALTER TABLE t1 ADD COLUMN col INT;
SELECT * FROM t1 WHERE vi < 2;
DROP TABLE t1, t2;
......@@ -8497,7 +8497,10 @@ ha_innobase::build_template(
index_contains = dict_index_contains_col_or_prefix(
index, num_v, true);
if (index_contains)
{
m_prebuilt->n_template = 0;
goto no_icp;
}
} else {
index_contains = dict_index_contains_col_or_prefix(
index, i - num_v, false);
......
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