List:Commits« Previous MessageNext Message »
From:Sergey Vojtovich Date:September 8 2009 10:47am
Subject:bzr commit into mysql-5.1-bugteam branch (svoj:3108) Bug#29203
View as plain text  
#At file:///home/svoj/devel/bzr-mysql/mysql-5.1-bugteam-bug29203/ based on revid:martin.hansson@stripped

 3108 Sergey Vojtovich	2009-09-08
      BUG#29203 - archive tables have weird values in show table status
      
      Archive engine returns wrong values for average record length
      and max data length.
      
      With this fix they're calculated as following:
      - max data length is 2 ^ 63 where large files are supported
        and INT_MAX32 where this is not supported;
      - average record length is data length / records in data file.
     @ mysql-test/r/archive.result
        A test case for BUG#29203.
     @ mysql-test/t/archive.test
        A test case for BUG#29203.
     @ storage/archive/ha_archive.cc
        Better estimation for average row length and maximal data
        file length.

    modified:
      mysql-test/r/archive.result
      mysql-test/t/archive.test
      storage/archive/ha_archive.cc
=== modified file 'mysql-test/r/archive.result'
--- a/mysql-test/r/archive.result	2009-03-26 14:27:34 +0000
+++ b/mysql-test/r/archive.result	2009-09-08 10:47:35 +0000
@@ -12695,3 +12695,14 @@ a	b
 1	NULL
 2	NULL
 DROP TABLE t1;
+CREATE TABLE t1(a INT, b BLOB) ENGINE=archive;
+SELECT DATA_LENGTH, AVG_ROW_LENGTH, MAX_DATA_LENGTH FROM
+INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test';
+DATA_LENGTH	AVG_ROW_LENGTH	MAX_DATA_LENGTH
+8666	15	9223372036854775807
+INSERT INTO t1 VALUES(1, 'sampleblob1'),(2, 'sampleblob2');
+SELECT DATA_LENGTH, AVG_ROW_LENGTH, MAX_DATA_LENGTH FROM
+INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test';
+DATA_LENGTH	AVG_ROW_LENGTH	MAX_DATA_LENGTH
+8700	4350	9223372036854775807
+DROP TABLE t1;

=== modified file 'mysql-test/t/archive.test'
--- a/mysql-test/t/archive.test	2009-03-26 14:27:34 +0000
+++ b/mysql-test/t/archive.test	2009-09-08 10:47:35 +0000
@@ -1599,3 +1599,14 @@ INSERT INTO t1 VALUES (NULL, NULL),(NULL
 FLUSH TABLE t1;
 SELECT * FROM t1 ORDER BY a;
 DROP TABLE t1;
+
+#
+# BUG#29203 - archive tables have weird values in show table status
+#
+CREATE TABLE t1(a INT, b BLOB) ENGINE=archive;
+SELECT DATA_LENGTH, AVG_ROW_LENGTH, MAX_DATA_LENGTH FROM
+  INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test';
+INSERT INTO t1 VALUES(1, 'sampleblob1'),(2, 'sampleblob2');
+SELECT DATA_LENGTH, AVG_ROW_LENGTH, MAX_DATA_LENGTH FROM
+  INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test';
+DROP TABLE t1;

=== 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-09-08 10:47:35 +0000
@@ -1472,11 +1472,12 @@ int ha_archive::info(uint flag)
 
     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;
+    stats.mean_rec_length= stats.records ?
+      stats.data_file_length / stats.records : table->s->reclength;
+    stats.max_data_file_length= MAX_FILE_SIZE;
   }
   stats.delete_length= 0;
   stats.index_file_length=0;


Attachment: [text/bzr-bundle] bzr/svoj@sun.com-20090908104735-tnp1xe81m39cbopr.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (svoj:3108) Bug#29203Sergey Vojtovich8 Sep