List:Commits« Previous MessageNext Message »
From:Sergey Glukhov Date:October 9 2008 10:54am
Subject:bzr push into mysql-5.1 branch (Sergey.Glukhov:2771 to 2772) Bug#39372
View as plain text  
 2772 Sergey Glukhov	2008-10-09
      Bug#39372 "Smart" ALTER TABLE not so smart after all.
      The problem was that PACK_KEYS and MAX_ROWS clause in ALTER TABLE did not trigger
      table reconstruction.
      The fix is to rebuild a table if PACK_KEYS or MAX_ROWS are specified.
modified:
  mysql-test/r/alter_table.result
  mysql-test/t/alter_table.test
  sql/sql_table.cc

 2771 Sergey Glukhov	2008-10-09
      Bug#35068 Assertion fails when reading from i_s.tables and there is incorrect merge table
      Hide "Table doesn't exist" errors if the table belongs to a merge table.
modified:
  mysql-test/r/merge.result
  mysql-test/t/merge.test
  sql/sql_base.cc

=== modified file 'mysql-test/r/alter_table.result'
--- a/mysql-test/r/alter_table.result	2008-06-17 14:12:21 +0000
+++ b/mysql-test/r/alter_table.result	2008-10-09 10:49:13 +0000
@@ -1222,4 +1222,22 @@ ALTER TABLE t1 CHANGE d c varchar(10);
 affected rows: 0
 info: Records: 0  Duplicates: 0  Warnings: 0
 DROP TABLE t1;
+create table t1(f1 int not null, f2 int not null, key  (f1), key (f2));
+select index_length into @unpaked_keys_size from
+information_schema.tables where table_name='t1';
+alter table t1 pack_keys=1;
+select index_length into @paked_keys_size from
+information_schema.tables where table_name='t1';
+select (@unpaked_keys_size > @paked_keys_size);
+(@unpaked_keys_size > @paked_keys_size)
+1
+select max_data_length into @orig_max_data_length from
+information_schema.tables where table_name='t1';
+alter table t1 max_rows=100;
+select max_data_length into @changed_max_data_length from
+information_schema.tables where table_name='t1';
+select (@orig_max_data_length > @changed_max_data_length);
+(@orig_max_data_length > @changed_max_data_length)
+1
+drop table t1;
 End of 5.1 tests

=== modified file 'mysql-test/t/alter_table.test'
--- a/mysql-test/t/alter_table.test	2008-06-17 14:12:21 +0000
+++ b/mysql-test/t/alter_table.test	2008-10-09 10:49:13 +0000
@@ -947,4 +947,34 @@ ALTER TABLE t1 CHANGE d c varchar(10);
 --disable_info
 DROP TABLE t1;
 
+#
+# Bug#39372 "Smart" ALTER TABLE not so smart after all.
+#
+create table t1(f1 int not null, f2 int not null, key  (f1), key (f2));
+let $count= 50;
+--disable_query_log
+while ($count)
+{
+  EVAL insert into t1 values (1,1),(1,1),(1,1),(1,1),(1,1);
+  EVAL insert into t1 values (2,2),(2,2),(2,2),(2,2),(2,2);
+  dec $count ;
+}
+--enable_query_log
+
+select index_length into @unpaked_keys_size from
+information_schema.tables where table_name='t1';
+alter table t1 pack_keys=1;
+select index_length into @paked_keys_size from
+information_schema.tables where table_name='t1';
+select (@unpaked_keys_size > @paked_keys_size);
+
+select max_data_length into @orig_max_data_length from
+information_schema.tables where table_name='t1';
+alter table t1 max_rows=100;
+select max_data_length into @changed_max_data_length from
+information_schema.tables where table_name='t1';
+select (@orig_max_data_length > @changed_max_data_length);
+
+drop table t1;
+
 --echo End of 5.1 tests

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2008-10-06 20:36:15 +0000
+++ b/sql/sql_table.cc	2008-10-09 10:49:13 +0000
@@ -5281,6 +5281,8 @@ compare_tables(TABLE *table,
       create_info->used_fields & HA_CREATE_USED_CHARSET ||
       create_info->used_fields & HA_CREATE_USED_DEFAULT_CHARSET ||
       create_info->used_fields & HA_CREATE_USED_ROW_FORMAT ||
+      create_info->used_fields & HA_CREATE_USED_PACK_KEYS ||
+      create_info->used_fields & HA_CREATE_USED_MAX_ROWS ||
       (alter_info->flags & (ALTER_RECREATE | ALTER_FOREIGN_KEY)) ||
       order_num ||
       !table->s->mysql_version ||

Thread
bzr push into mysql-5.1 branch (Sergey.Glukhov:2771 to 2772) Bug#39372Sergey Glukhov9 Oct