From: Date: April 10 2006 5:35pm Subject: bk commit into 5.1 tree (gluh:1.2308) BUG#18753 List-Archive: http://lists.mysql.com/commits/4726 X-Bug: 18753 Message-Id: <20060410153524.715E0528F60@eagle.intranet.mysql.r18.ru> Below is the list of changes that have just been committed into a local 5.1 repository of gluh. When gluh 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 1.2308 06/04/10 20:35:12 gluh@stripped +3 -0 Fix for bug#18753 Partitions: auto_increment fails Current auto increment value is placed in partition in which latest record was saved. So to get auto_increment they have to scan all partitions and return max value. sql/ha_partition.cc 1.43 06/04/10 20:35:05 gluh@stripped +8 -6 Fix for bug#18753 Partitions: auto_increment fails Current auto increment value is placed in partition in which latest record was saved. So to get auto_increment they have to scan all partitions and return max value. mysql-test/t/partition.test 1.34 06/04/10 20:35:05 gluh@stripped +15 -0 Fix for bug#18753 Partitions: auto_increment fails test case mysql-test/r/partition.result 1.32 06/04/10 20:35:05 gluh@stripped +17 -0 Fix for bug#18753 Partitions: auto_increment fails test case # 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: gluh # Host: eagle.intranet.mysql.r18.ru # Root: /home/gluh/MySQL/Merge/5.1-new --- 1.31/mysql-test/r/partition.result Sat Apr 1 10:59:21 2006 +++ 1.32/mysql-test/r/partition.result Mon Apr 10 20:35:05 2006 @@ -839,4 +839,21 @@ 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 Dynamic 0 0 0 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned DROP TABLE t1; +create table t1 (s1 int auto_increment primary key) +partition by list (s1) +(partition p1 values in (1), +partition p2 values in (2), +partition p3 values in (3)); +insert into t1 values (null); +insert into t1 values (null); +insert into t1 values (null); +select auto_increment from information_schema.tables where table_name='t1'; +auto_increment +4 +select * from t1; +s1 +1 +2 +3 +drop table t1; End of 5.1 tests --- 1.33/mysql-test/t/partition.test Sat Apr 1 10:59:21 2006 +++ 1.34/mysql-test/t/partition.test Mon Apr 10 20:35:05 2006 @@ -956,4 +956,19 @@ PARTITION p2 VALUES LESS THAN (30) ENGIN SHOW TABLE STATUS; DROP TABLE t1; +# +# Bug#18753 Partitions: auto_increment fails +# +create table t1 (s1 int auto_increment primary key) +partition by list (s1) +(partition p1 values in (1), + partition p2 values in (2), + partition p3 values in (3)); +insert into t1 values (null); +insert into t1 values (null); +insert into t1 values (null); +select auto_increment from information_schema.tables where table_name='t1'; +select * from t1; +drop table t1; + --echo End of 5.1 tests --- 1.42/sql/ha_partition.cc Fri Mar 31 22:41:59 2006 +++ 1.43/sql/ha_partition.cc Mon Apr 10 20:35:05 2006 @@ -4201,11 +4201,7 @@ void ha_partition::info(uint flag) if (flag & HA_STATUS_AUTO) { DBUG_PRINT("info", ("HA_STATUS_AUTO")); - /* - The auto increment value is only maintained by the first handler - so we will only call this. - */ - m_file[0]->info(HA_STATUS_AUTO); + auto_increment_value= get_auto_increment(); } if (flag & HA_STATUS_VARIABLE) { @@ -5349,9 +5345,15 @@ void ha_partition::restore_auto_incremen ulonglong ha_partition::get_auto_increment() { + ulonglong auto_inc, max_auto_inc= 0; DBUG_ENTER("ha_partition::get_auto_increment"); - DBUG_RETURN(m_file[0]->get_auto_increment()); + for (uint i= 0; i < m_tot_parts; i++) + { + auto_inc= m_file[i]->get_auto_increment(); + set_if_bigger(max_auto_inc, auto_inc); + } + DBUG_RETURN(max_auto_inc); }