diff options
author | Monty <monty@mariadb.org> | 2017-01-09 18:46:20 +0200 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2017-01-11 09:19:45 +0200 |
commit | c9b3e4535bb4b6d2aa0f7bc1ce71730e6aceca8b (patch) | |
tree | 7c6891ac7cd5283f506a28caf54b60055af15bb0 | |
parent | 6c5c98316f6c5e4ad84ce5b4cb657459828e805d (diff) | |
download | mariadb-git-c9b3e4535bb4b6d2aa0f7bc1ce71730e6aceca8b.tar.gz |
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
-rw-r--r-- | mysql-test/suite/vcol/r/vcol_keys_innodb.result | 10 | ||||
-rw-r--r-- | mysql-test/suite/vcol/t/vcol_keys_innodb.test | 59 | ||||
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 3 |
3 files changed, 48 insertions, 24 deletions
diff --git a/mysql-test/suite/vcol/r/vcol_keys_innodb.result b/mysql-test/suite/vcol/r/vcol_keys_innodb.result index 19e0db00336..5053b5105cf 100644 --- a/mysql-test/suite/vcol/r/vcol_keys_innodb.result +++ b/mysql-test/suite/vcol/r/vcol_keys_innodb.result @@ -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; diff --git a/mysql-test/suite/vcol/t/vcol_keys_innodb.test b/mysql-test/suite/vcol/t/vcol_keys_innodb.test index 8eeef96b43f..c872a9a6fe0 100644 --- a/mysql-test/suite/vcol/t/vcol_keys_innodb.test +++ b/mysql-test/suite/vcol/t/vcol_keys_innodb.test @@ -1,34 +1,34 @@ -################################################################################ -# 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; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index ff80d967092..d9c32f286e6 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -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); |