#At file:///Users/mattiasj/clones/bzrroot/b44622-51-bugteam/ based on revid:li-bing.song@stripped
3063 Mattias Jonsson 2009-08-11
Bug#44622: Using PARTITIONs with ARCHIVE engine reports 0 bytes in i_s.TABLES
Problem was that ha_archive::info did not use the flag argument
correctly
fixed so that it updated the correct values depending on the flag.
@ mysql-test/r/partition_archive.result
Bug#44622: Using PARTITIONs with ARCHIVE engine reports 0 bytes in i_s.TABLES
Updated testresult
@ mysql-test/t/partition_archive.test
Bug#44622: Using PARTITIONs with ARCHIVE engine reports 0 bytes in i_s.TABLES
Added testcase
@ storage/archive/ha_archive.cc
Bug#44622: Using PARTITIONs with ARCHIVE engine reports 0 bytes in i_s.TABLES
Fixed ha_archive::info() so that it updated the correct values
depending on the flag. (did it all only if HA_STATUS_TIME before...)
modified:
mysql-test/r/partition_archive.result
mysql-test/t/partition_archive.test
storage/archive/ha_archive.cc
=== modified file 'mysql-test/r/partition_archive.result'
--- a/mysql-test/r/partition_archive.result 2008-11-04 07:43:21 +0000
+++ b/mysql-test/r/partition_archive.result 2009-08-11 12:18:26 +0000
@@ -1,3 +1,25 @@
+CREATE TABLE t1 (f1 DATE NOT NULL)
+ENGINE = ARCHIVE PARTITION BY RANGE (TO_DAYS(f1))
+(partition p1 values less than (733751),
+partition p2 values less than MAXVALUE);
+INSERT INTO t1 VALUES(CURRENT_DATE);
+SELECT DATA_LENGTH, INDEX_LENGTH FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
+DATA_LENGTH INDEX_LENGTH
+190 0
+SELECT DATA_LENGTH, INDEX_LENGTH FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
+DATA_LENGTH INDEX_LENGTH
+190 0
+DROP TABLE t1;
+CREATE TABLE t1 (f1 DATE NOT NULL)
+ENGINE = ARCHIVE;
+INSERT INTO t1 VALUES(CURRENT_DATE);
+SELECT DATA_LENGTH, INDEX_LENGTH FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
+DATA_LENGTH INDEX_LENGTH
+8658 0
+SELECT DATA_LENGTH, INDEX_LENGTH FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
+DATA_LENGTH INDEX_LENGTH
+8658 0
+DROP TABLE t1;
drop database if exists db99;
drop table if exists t1;
create database db99;
=== modified file 'mysql-test/t/partition_archive.test'
--- a/mysql-test/t/partition_archive.test 2007-12-06 18:17:42 +0000
+++ b/mysql-test/t/partition_archive.test 2009-08-11 12:18:26 +0000
@@ -10,6 +10,27 @@
--source include/have_partition.inc
--source include/have_archive.inc
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+#
+# Bug#44622: Using PARTITIONs with ARCHIVE engine reports 0 bytes in i_s.TABLES
+#
+CREATE TABLE t1 (f1 DATE NOT NULL)
+ENGINE = ARCHIVE PARTITION BY RANGE (TO_DAYS(f1))
+(partition p1 values less than (733751),
+ partition p2 values less than MAXVALUE);
+
+INSERT INTO t1 VALUES(CURRENT_DATE);
+
+SELECT DATA_LENGTH, INDEX_LENGTH FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
+SELECT DATA_LENGTH, INDEX_LENGTH FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
+DROP TABLE t1;
+CREATE TABLE t1 (f1 DATE NOT NULL)
+ENGINE = ARCHIVE;
+INSERT INTO t1 VALUES(CURRENT_DATE);
+SELECT DATA_LENGTH, INDEX_LENGTH FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
+SELECT DATA_LENGTH, INDEX_LENGTH FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
+DROP TABLE t1;
#
# Bug 17310 Partitions: Bugs with archived partitioned tables
=== modified file 'storage/archive/ha_archive.cc'
--- a/storage/archive/ha_archive.cc 2009-05-15 13:03:22 +0000
+++ b/storage/archive/ha_archive.cc 2009-08-11 12:18:26 +0000
@@ -1466,20 +1466,27 @@ int ha_archive::info(uint flag)
DBUG_PRINT("ha_archive", ("Stats rows is %d\n", (int)stats.records));
/* Costs quite a bit more to get all information */
- if (flag & HA_STATUS_TIME)
+ if (flag & (HA_STATUS_TIME | HA_STATUS_CONST | HA_STATUS_VARIABLE))
{
MY_STAT file_stat; // Stat information for the data file
VOID(my_stat(share->data_file_name, &file_stat, MYF(MY_WME)));
- stats.mean_rec_length= table->s->reclength + buffer.alloced_length();
- stats.data_file_length= file_stat.st_size;
- stats.create_time= (ulong) file_stat.st_ctime;
- stats.update_time= (ulong) file_stat.st_mtime;
- stats.max_data_file_length= share->rows_recorded * stats.mean_rec_length;
+ if (flag & HA_STATUS_TIME)
+ stats.update_time= (ulong) file_stat.st_mtime;
+ if (flag & HA_STATUS_CONST)
+ {
+ stats.max_data_file_length= share->rows_recorded * stats.mean_rec_length;
+ stats.create_time= (ulong) file_stat.st_ctime;
+ }
+ if (flag & HA_STATUS_VARIABLE)
+ {
+ stats.delete_length= 0;
+ stats.data_file_length= file_stat.st_size;
+ stats.index_file_length=0;
+ stats.mean_rec_length= table->s->reclength + buffer.alloced_length();
+ }
}
- stats.delete_length= 0;
- stats.index_file_length=0;
if (flag & HA_STATUS_AUTO)
{
Attachment: [text/bzr-bundle]