BUG#19501: Data_Free incorrectly handled for partitioned tables

parent 4ba1a4b3
......@@ -886,4 +886,18 @@ s1
2
3
drop table t1;
CREATE TABLE t1 (a int) ENGINE = MYISAM PARTITION BY KEY(a);
INSERT into t1 values (1), (2);
SHOW TABLE STATUS;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MyISAM 10 Fixed 2 7 14 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
DELETE from t1 where a = 1;
SHOW TABLE STATUS;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MyISAM 10 Fixed 1 14 14 0 0 7 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
ALTER TABLE t1 OPTIMIZE PARTITION p0;
SHOW TABLE STATUS;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MyISAM 10 Fixed 1 7 7 0 1024 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
DROP TABLE t1;
End of 5.1 tests
......@@ -1009,4 +1009,19 @@ select auto_increment from information_schema.tables where table_name='t1';
select * from t1;
drop table t1;
#
# BUG 19501 Partitions: SHOW TABLE STATUS shows wrong Data_free
#
CREATE TABLE t1 (a int) ENGINE = MYISAM PARTITION BY KEY(a);
INSERT into t1 values (1), (2);
--replace_column 9 0 12 NULL 13 NULL 14 NULL
SHOW TABLE STATUS;
DELETE from t1 where a = 1;
--replace_column 9 0 12 NULL 13 NULL 14 NULL
SHOW TABLE STATUS;
ALTER TABLE t1 OPTIMIZE PARTITION p0;
--replace_column 12 NULL 13 NULL 14 NULL
SHOW TABLE STATUS;
DROP TABLE t1;
--echo End of 5.1 tests
......@@ -4169,6 +4169,8 @@ void ha_partition::info(uint flag)
index_file_length: Length of index file, in principle bytes in
indexes in the table
We report sum
delete_length: Length of free space easily used by new records in table
We report sum
mean_record_length:Mean record length in the table
We calculate this
check_time: Time of last check (only applicable to MyISAM)
......@@ -4178,6 +4180,7 @@ void ha_partition::info(uint flag)
deleted= 0;
data_file_length= 0;
index_file_length= 0;
delete_length= 0;
check_time= 0;
file_array= m_file;
do
......@@ -4190,6 +4193,7 @@ void ha_partition::info(uint flag)
deleted+= file->deleted;
data_file_length+= file->data_file_length;
index_file_length+= file->index_file_length;
delete_length+= file->delete_length;
if (file->check_time > check_time)
check_time= file->check_time;
}
......
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