MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:ramil Date:June 7 2007 10:50am
Subject:bk commit into 5.1 tree (ramil:1.2545) BUG#28806
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of ram. When ram does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-06-07 15:50:13+05:00, ramil@stripped +3 -0
  Fix for bug #28806: Running SHOW TABLE STATUS during high INSERT load crashes server
  
  Problem: getting an autoincrement value for a partition table in the ::info() method we call
  the get_auto_increment() for all partitions. That may cause a problem for at least MyISAM
  tables that rely on some table state (in this particular case table->naxt_nuber_field is 
  set to 0 in the mysql_insert() and we get a crash). 
  Moreover, calling get_auto_increment() is superfluous there.
  
  Fix: use ::info(HA_STATUS_AUTO) calls to get autoincrement values for partitions instead of
  get_auto_increment() ones in the ha_partition::info().

  mysql-test/r/partition.result@stripped, 2007-06-07 15:50:07+05:00, ramil@stripped +14 -0
    Fix for bug #28806: Running SHOW TABLE STATUS during high INSERT load crashes server
      - test result.

  mysql-test/t/partition.test@stripped, 2007-06-07 15:50:07+05:00, ramil@stripped +17 -0
    Fix for bug #28806: Running SHOW TABLE STATUS during high INSERT load crashes server
      - test case.

  sql/ha_partition.cc@stripped, 2007-06-07 15:50:07+05:00, ramil@stripped +8 -14
    Fix for bug #28806: Running SHOW TABLE STATUS during high INSERT load crashes server
      - use info(HA_STATUS_AUTO) calls to get autoincrement values for partitions,
        set the auto_increment_value as the biggest one.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	ramil
# Host:	ramil.myoffice.izhnet.ru
# Root:	/home/ram/work/b28806/b28806.5.1

--- 1.63/mysql-test/r/partition.result	2007-06-07 15:50:18 +05:00
+++ 1.64/mysql-test/r/partition.result	2007-06-07 15:50:18 +05:00
@@ -1235,4 +1235,18 @@ aaa	2
 drop table t1;
 create table t1 (s1 bigint) partition by list (s1) (partition p1 values in (-9223372036854775808));
 drop table t1;
+create table t1(a int auto_increment, b int, primary key (b, a)) 
+partition by hash(b) partitions 2;
+insert into t1 values (null, 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	9	9	0	0	0	1	NULL	NULL	NULL	latin1_swedish_ci	NULL	partitioned	
+drop table t1;
+create table t1(a int auto_increment primary key)
+partition by key(a) partitions 2;
+insert into t1 values (null), (null), (null);
+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	3	7	21	0	0	0	4	NULL	NULL	NULL	latin1_swedish_ci	NULL	partitioned	
+drop table t1;
 End of 5.1 tests

--- 1.57/mysql-test/t/partition.test	2007-06-07 15:50:18 +05:00
+++ 1.58/mysql-test/t/partition.test	2007-06-07 15:50:18 +05:00
@@ -1448,4 +1448,21 @@ drop table t1;
 create table t1 (s1 bigint) partition by list (s1) (partition p1 values in (-9223372036854775808));
 drop table t1;
 
+#
+# Bug #28806: Running SHOW TABLE STATUS during high INSERT load crashes server
+#
+create table t1(a int auto_increment, b int, primary key (b, a)) 
+  partition by hash(b) partitions 2;
+insert into t1 values (null, 1);
+--replace_column 9 0 12 NULL 13 NULL 14 NULL
+show table status;
+drop table t1;
+
+create table t1(a int auto_increment primary key)
+  partition by key(a) partitions 2;
+insert into t1 values (null), (null), (null);
+--replace_column 9 0 12 NULL 13 NULL 14 NULL
+show table status;
+drop table t1;
+
 --echo End of 5.1 tests

--- 1.93/sql/ha_partition.cc	2007-06-07 15:50:18 +05:00
+++ 1.94/sql/ha_partition.cc	2007-06-07 15:50:18 +05:00
@@ -4253,22 +4253,16 @@ int ha_partition::info(uint flag)
 
   if (flag & HA_STATUS_AUTO)
   {
-    ulonglong nb_reserved_values;
+    ulonglong auto_increment_value= 0;
     DBUG_PRINT("info", ("HA_STATUS_AUTO"));
-    /* we don't want to reserve any values, it's pure information */
-
-    if (table->found_next_number_field)
+    file_array= m_file;
+    do
     {
-      /*
-        Can only call get_auto_increment for tables that actually
-        have auto_increment columns, otherwise there will be
-        problems in handlers that don't expect get_auto_increment
-        for non-autoincrement tables.
-      */
-      get_auto_increment(0, 0, 0, &stats.auto_increment_value,
-                         &nb_reserved_values);
-      release_auto_increment();
-    }
+      file= *file_array;
+      file->info(HA_STATUS_AUTO);
+      set_if_bigger(auto_increment_value, file->stats.auto_increment_value);
+    } while (*(++file_array));
+    stats.auto_increment_value= auto_increment_value;
   }
   if (flag & HA_STATUS_VARIABLE)
   {
Thread
bk commit into 5.1 tree (ramil:1.2545) BUG#28806ramil7 Jun