diff --git a/mysql-test/suite/gcol/r/gcol_partition_innodb.result b/mysql-test/suite/gcol/r/gcol_partition_innodb.result index 9a0e676e76f..7600c9792f1 100644 --- a/mysql-test/suite/gcol/r/gcol_partition_innodb.result +++ b/mysql-test/suite/gcol/r/gcol_partition_innodb.result @@ -1,4 +1,6 @@ SET @@session.default_storage_engine = 'InnoDB'; +SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency; +SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; drop table if exists t1; # Case 1. Partitioning by RANGE based on a non-stored generated column. CREATE TABLE t1 ( @@ -86,6 +88,20 @@ CHECK TABLE t EXTENDED; Table Op Msg_type Msg_text test.t check status OK DROP TABLE t; +# +# MDEV-16980 Wrongly set tablename len while opening the +# table for purge thread +# +CREATE TABLE t1(pk SERIAL, d DATE, vd DATE AS (d) VIRTUAL, +PRIMARY KEY(pk), KEY (vd))ENGINE=InnoDB +PARTITION BY HASH(pk) PARTITIONS 2; +INSERT IGNORE INTO t1 (d) VALUES ('2015-04-14'); +SET sql_mode= ''; +REPLACE INTO t1 SELECT * FROM t1; +Warnings: +Warning 1906 The value specified for generated column 'vd' in table 't1' ignored +DROP TABLE t1; +InnoDB 0 transactions not purged DROP VIEW IF EXISTS v1,v2; DROP TABLE IF EXISTS t1,t2,t3; DROP PROCEDURE IF EXISTS p1; @@ -93,3 +109,4 @@ DROP FUNCTION IF EXISTS f1; DROP TRIGGER IF EXISTS trg1; DROP TRIGGER IF EXISTS trg2; set sql_warnings = 0; +SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; diff --git a/mysql-test/suite/gcol/t/gcol_partition_innodb.test b/mysql-test/suite/gcol/t/gcol_partition_innodb.test index 06e6ccc1ba4..75e2f80af20 100644 --- a/mysql-test/suite/gcol/t/gcol_partition_innodb.test +++ b/mysql-test/suite/gcol/t/gcol_partition_innodb.test @@ -30,6 +30,8 @@ # Set the session storage engine --source include/have_innodb.inc eval SET @@session.default_storage_engine = 'InnoDB'; +SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency; +SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; ##### Workarounds for known open engine specific bugs # none @@ -41,6 +43,24 @@ eval SET @@session.default_storage_engine = 'InnoDB'; #------------------------------------------------------------------------------# # Execute storage engine specific tests +--echo # +--echo # MDEV-16980 Wrongly set tablename len while opening the +--echo # table for purge thread +--echo # + +CREATE TABLE t1(pk SERIAL, d DATE, vd DATE AS (d) VIRTUAL, + PRIMARY KEY(pk), KEY (vd))ENGINE=InnoDB + PARTITION BY HASH(pk) PARTITIONS 2; + +INSERT IGNORE INTO t1 (d) VALUES ('2015-04-14'); +SET sql_mode= ''; +REPLACE INTO t1 SELECT * FROM t1; + +# Cleanup +DROP TABLE t1; + +--source suite/innodb/include/wait_all_purged.inc #------------------------------------------------------------------------------# # Cleanup --source suite/gcol/inc/gcol_cleanup.inc +SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; diff --git a/sql/table.h b/sql/table.h index fc3102fc9a5..33b921cd946 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1765,6 +1765,8 @@ struct TABLE_LIST mdl_type= MDL_SHARED_READ; bzero((char*) this, sizeof(*this)); + DBUG_ASSERT(!db_name_arg || strlen(db_name_arg) == db_length_arg); + DBUG_ASSERT(!table_name_arg || strlen(table_name_arg) == table_name_length_arg); db= (char*) db_name_arg; db_length= db_length_arg; table_name= (char*) table_name_arg; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index b7d3c6da099..49f51c78f73 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -21341,6 +21341,7 @@ static bool table_name_parse( if (char *is_part = strchr(tbl_buf, '#')) { *is_part = '\0'; + tblnamelen = is_part - tbl_buf; } filename_to_tablename(tbl_buf, tblname, MAX_TABLE_NAME_LEN + 1, true);