Commit b4c28de0 authored by marko's avatar marko

branches/zip: Always check for "row too large" when executing SQL to create

an index or table.  We have to skip this check when loading table definitions
from the data dictionary, because we could otherwise refuse to load old
tables (even uncompressed ones).  This addresses Issue #119.

The first "row too large" check was implemented in MySQL 5.0.3
to address MySQL Bug #5682.  In the InnoDB Plugin 1.0.2, a more
accurate check was implemented in innodb_strict_mode.  We now
make the check unconditional.

dict_create_index_step(): Pass strict=TRUE to dict_index_add_to_cache().

trx_is_strict(), thd_is_strict(): Remove.

innodb-zip.test: Test in innodb_strict_mode=OFF.

innodb_bug36169.test: Ensure that none of the tables can be created.

rb://56 approved by Sunny Bains.
parent d8639d00
......@@ -1079,7 +1079,7 @@ dict_create_index_step(
dulint index_id = node->index->id;
err = dict_index_add_to_cache(node->table, node->index,
FIL_NULL, trx_is_strict(trx));
FIL_NULL, TRUE);
node->index = dict_index_get_if_in_cache_low(index_id);
ut_a(!node->index == (err != DB_SUCCESS));
......
......@@ -621,18 +621,6 @@ thd_supports_xa(
return(THDVAR((THD*) thd, support_xa));
}
/**********************************************************************
Returns true if the thread is executing in innodb_strict_mode. */
extern "C" UNIV_INTERN
ibool
thd_is_strict(
/*==========*/
/* out: true if thd is in strict mode */
void* thd) /* in: thread handle (THD*) */
{
return(THDVAR((THD*) thd, strict_mode));
}
/**********************************************************************
Returns the lock wait timeout for the current connection. */
extern "C" UNIV_INTERN
......
......@@ -217,15 +217,6 @@ thd_supports_xa(
void* thd); /* in: thread handle (THD*), or NULL to query
the global innodb_supports_xa */
/**********************************************************************
Returns true if the thread is executing in innodb_strict_mode. */
ibool
thd_is_strict(
/*==========*/
/* out: true if thd is in strict mode */
void* thd); /* in: thread handle (THD*) */
/**********************************************************************
Returns the lock wait timeout for the current connection. */
......
......@@ -407,15 +407,6 @@ trx_is_interrupted(
#define trx_is_interrupted(trx) FALSE
#endif /* !UNIV_HOTBACKUP */
/**************************************************************************
Determines if the currently running transaction is in innodb_strict_mode. */
UNIV_INTERN
ibool
trx_is_strict(
/*==========*/
/* out: TRUE if strict */
trx_t* trx); /* in: transaction */
/***********************************************************************
Calculates the "weight" of a transaction. The weight of one transaction
is estimated as the number of altered rows + the number of locked rows.
......
......@@ -122,7 +122,7 @@ table_schema table_name row_format
test t1 Compressed
test t2 Compact
drop table t1,t2;
SET SESSION innodb_strict_mode = on;
SET SESSION innodb_strict_mode = off;
CREATE TABLE t1(
c TEXT NOT NULL, d TEXT NOT NULL,
PRIMARY KEY (c(767),d(767)))
......
......@@ -84,7 +84,8 @@ SELECT table_schema, table_name, row_format
FROM information_schema.tables WHERE engine='innodb';
drop table t1,t2;
SET SESSION innodb_strict_mode = on;
# The following should fail even in non-strict mode.
SET SESSION innodb_strict_mode = off;
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE t1(
c TEXT NOT NULL, d TEXT NOT NULL,
......
......@@ -22,6 +22,7 @@ SET GLOBAL innodb_file_per_table=ON;
# Generating 10 tables
# Creating a table with 94 columns and 24 indexes
DROP TABLE IF EXISTS `table0`;
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE IF NOT EXISTS `table0`
(`col0` BOOL,
`col1` BOOL,
......@@ -145,6 +146,7 @@ KEY `idx23` (`col7`(163),`col31`,`col71`,`col14`)
# Creating a table with 10 columns and 32 indexes
DROP TABLE IF EXISTS `table1`;
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE IF NOT EXISTS `table1`
(`col0` CHAR (113),
`col1` FLOAT,
......@@ -192,6 +194,7 @@ KEY `idx31` (`col4`(1),`col0`)
# Creating a table with 141 columns and 18 indexes
DROP TABLE IF EXISTS `table2`;
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE IF NOT EXISTS `table2`
(`col0` BOOL,
`col1` MEDIUMINT,
......@@ -356,6 +359,7 @@ KEY `idx17` (`col24`(250),`col7`,`col92`,`col45`)
# Creating a table with 199 columns and 1 indexes
DROP TABLE IF EXISTS `table3`;
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE IF NOT EXISTS `table3`
(`col0` SMALLINT,
`col1` SET ('test1','test2','test3'),
......@@ -561,6 +565,7 @@ KEY `idx0` (`col39`,`col23`)
# Creating a table with 133 columns and 16 indexes
DROP TABLE IF EXISTS `table4`;
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE IF NOT EXISTS `table4`
(`col0` VARCHAR (60),
`col1` NUMERIC,
......@@ -715,6 +720,7 @@ KEY `idx15` (`col4`(246),`col130`,`col115`,`col3`(141))
# Creating a table with 176 columns and 13 indexes
DROP TABLE IF EXISTS `table5`;
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE IF NOT EXISTS `table5`
(`col0` MEDIUMTEXT,
`col1` VARCHAR (90),
......@@ -910,6 +916,7 @@ KEY `idx12` (`col24`)
# Creating a table with 179 columns and 46 indexes
DROP TABLE IF EXISTS `table6`;
-- error ER_TOO_BIG_ROWSIZE
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE IF NOT EXISTS `table6`
(`col0` ENUM ('test1','test2','test3'),
`col1` MEDIUMBLOB,
......
......@@ -34,22 +34,6 @@ UNIV_INTERN sess_t* trx_dummy_sess = NULL;
the kernel mutex */
UNIV_INTERN ulint trx_n_mysql_transactions = 0;
/**************************************************************************
Determines if the currently running transaction is in innodb_strict_mode. */
UNIV_INTERN
ibool
trx_is_strict(
/*==========*/
/* out: TRUE if strict */
trx_t* trx) /* in: transaction */
{
#ifndef UNIV_HOTBACKUP
return(trx && trx->mysql_thd && thd_is_strict(trx->mysql_thd));
#else /* UNIV_HOTBACKUP */
return(FALSE);
#endif /* UNIV_HOTBACKUP */
}
/*****************************************************************
Set detailed error message for the transaction. */
UNIV_INTERN
......
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