Bug #79223 ALTER TABLE...TRUNCATE PARTITION forgets KEY_BLOCK_SIZE
Submitted: 11 Nov 2015 8:33 Modified: 13 Nov 2015 14:58
Reporter: Marko Mäkelä Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:8.0.0 OS:Any
Assigned to: CPU Architecture:Any

[11 Nov 2015 8:33] Marko Mäkelä
Description:
This seems to be a regression from WL#6795.

ALTER TABLE...TRUNCATE PARTITION will ignore the KEY_BLOCK_SIZE attribute of the table, and use the default value (half of innodb_page_size).

How to repeat:
./mtr --mysqld=--innodb-page-size=4k innodb_zip.restart
./mtr --mysqld=--innodb-page-size=8k innodb_zip.restart

The test was re-recorded with bogus output (8192 instead of 2048).

Simplified test case:

let $MYSQLD_DATADIR = `select @@datadir`;
LET $INNODB_PAGE_SIZE = `select @@innodb_page_size`;
CREATE TABLE t0(c1 INT) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 ENGINE=InnoDB;
CREATE TABLE t1(c1 INT) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 ENGINE=InnoDB
       PARTITION BY HASH(c1) (PARTITION p0, PARTITION p1, PARTITION p2);

TRUNCATE TABLE t0;
ALTER TABLE t1 TRUNCATE PARTITION p1;
--source suite/innodb/include/show_i_s_tablespaces.inc
DROP TABLE t0,t1;

Note that in the output, test/t1#p#p1 will be listed with Zip_size=8192, while all the other tables and partitions are listed using the proper value 2048.

Suggested fix:
Adjust ha_innopart::truncate() and possibly also ha_innobase::truncate().
[13 Nov 2015 14:58] Daniel Price
Posted by developer:
 
Fixed as of the upcoming 5.8.0 release, and here's the changelog entry:

An ALTER TABLE...TRUNCATE PARTITION operation ignored the table's
KEY_BLOCK_SIZE attribute and used the default value instead, which is half
of the innodb_page_size value.
[18 Jun 2016 21:34] Omer Barnir
Posted by developer:
 
Reported version value updated to reflect release name change from 5.8 to 8.0