List:Internals« Previous MessageNext Message »
From:ramil Date:March 15 2005 4:31pm
Subject:bk commit into 5.0 tree (ramil:1.1810)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 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
  1.1810 05/03/15 19:31:52 ramil@stripped +5 -0
  merging

  sql/ha_heap.cc
    1.58 05/03/15 19:31:47 ramil@stripped +4 -4
    manual merging

  mysql-test/t/heap.test
    1.23 05/03/15 19:31:47 ramil@stripped +0 -0
    manual merging

  mysql-test/r/heap.result
    1.33 05/03/15 19:31:47 ramil@stripped +0 -0
    manual merging

  sql/filesort.cc
    1.101 05/03/15 19:19:00 ramil@stripped +0 -0
    Auto merged

  heap/hp_create.c
    1.18 05/03/15 19:19:00 ramil@stripped +0 -0
    Auto merged

# 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:	gw.mysql.r18.ru
# Root:	/usr/home/ram/work/5.0/RESYNC

--- 1.17/heap/hp_create.c	2005-01-15 14:37:11 +04:00
+++ 1.18/heap/hp_create.c	2005-03-15 19:19:00 +04:00
@@ -168,6 +168,8 @@
 	keyinfo->write_key= hp_write_key;
         keyinfo->hash_buckets= 0;
       }
+      if ((keyinfo->flag & HA_AUTO_KEY) &&
create_info->with_auto_increment)
+        share->auto_key= i + 1;
     }
     share->min_records= min_records;
     share->max_records= max_records;
@@ -178,7 +180,6 @@
     share->keys= keys;
     share->max_key_length= max_length;
     share->changed= 0;
-    share->auto_key= create_info->auto_key;
     share->auto_key_type= create_info->auto_key_type;
     share->auto_increment= create_info->auto_increment;
     /* Must be allocated separately for rename to work */

--- 1.100/sql/filesort.cc	2005-03-10 15:58:41 +04:00
+++ 1.101/sql/filesort.cc	2005-03-15 19:19:00 +04:00
@@ -475,8 +475,11 @@
     if (*killed)
     {
       DBUG_PRINT("info",("Sort killed by user"));
-      (void) file->extra(HA_EXTRA_NO_CACHE);
-      file->ha_rnd_end();
+      if (!indexfile && !quick_select)
+      {
+        (void) file->extra(HA_EXTRA_NO_CACHE);
+        file->ha_rnd_end();
+      }
       DBUG_RETURN(HA_POS_ERROR);		/* purecov: inspected */
     }
     if (error == 0)

--- 1.57/sql/ha_heap.cc	2005-03-09 22:22:21 +04:00
+++ 1.58/sql/ha_heap.cc	2005-03-15 19:31:47 +04:00
@@ -457,6 +457,7 @@
   char buff[FN_REFLEN];
   int error;
   TABLE_SHARE *share= table_arg->s;
+  bool found_real_auto_increment= 0;
 
   for (key= parts= 0; key < keys; key++)
     parts+= table_arg->key_info[key].key_parts;
@@ -520,19 +521,22 @@
 	seg->null_bit= 0;
 	seg->null_pos= 0;
       }
+      // We have to store field->key_type() as seg->type can differ from it
       if (field->flags & AUTO_INCREMENT_FLAG)
-      {
-	auto_key= key + 1;
 	auto_key_type= field->key_type();
-      }
     }
   }
   mem_per_row+= MY_ALIGN(share->reclength + 1, sizeof(char*));
   max_rows = (ha_rows) (table->in_use->variables.max_heap_table_size /
 			mem_per_row);
+  if (table_arg->found_next_number_field)
+  {
+    keydef[table_arg->next_number_index].flag|= HA_AUTO_KEY;
+    found_real_auto_increment= table_arg->next_number_key_offset == 0;
+  }
   HP_CREATE_INFO hp_create_info;
-  hp_create_info.auto_key= auto_key;
   hp_create_info.auto_key_type= auto_key_type;
+  hp_create_info.with_auto_increment= found_real_auto_increment;
   hp_create_info.auto_increment= (create_info->auto_increment_value ?
 				  create_info->auto_increment_value - 1 : 0);
   hp_create_info.max_table_size=current_thd->variables.max_heap_table_size;

--- 1.32/mysql-test/r/heap.result	2005-01-14 05:36:16 +04:00
+++ 1.33/mysql-test/r/heap.result	2005-03-15 19:31:47 +04:00
@@ -665,3 +665,45 @@
 65530
 drop table t1;
 set storage_engine=MyISAM;
+create table t1 (a bigint unsigned auto_increment primary key, b int,
+key (b, a)) engine=heap;
+insert t1 (b) values (1);
+insert t1 (b) values (1);
+insert t1 (b) values (1);
+insert t1 (b) values (1);
+insert t1 (b) values (1);
+insert t1 (b) values (1);
+insert t1 (b) values (1);
+insert t1 (b) values (1);
+select * from t1;
+a	b
+1	1
+2	1
+3	1
+4	1
+5	1
+6	1
+7	1
+8	1
+drop table t1;
+create table t1 (a int not null, b int not null auto_increment,
+primary key(a, b), key(b)) engine=heap;
+insert t1 (a) values (1);
+insert t1 (a) values (1);
+insert t1 (a) values (1);
+insert t1 (a) values (1);
+insert t1 (a) values (1);
+insert t1 (a) values (1);
+insert t1 (a) values (1);
+insert t1 (a) values (1);
+select * from t1;
+a	b
+1	1
+1	2
+1	3
+1	4
+1	5
+1	6
+1	7
+1	8
+drop table t1;

--- 1.22/mysql-test/t/heap.test	2004-12-12 21:54:18 +04:00
+++ 1.23/mysql-test/t/heap.test	2005-03-15 19:31:47 +04:00
@@ -406,3 +406,32 @@
 # Reset varchar test
 #
 eval set storage_engine=$default;
+
+#
+# Bug #8489: Strange auto_increment behaviour
+#
+
+create table t1 (a bigint unsigned auto_increment primary key, b int,
+  key (b, a)) engine=heap;
+insert t1 (b) values (1);
+insert t1 (b) values (1);
+insert t1 (b) values (1);
+insert t1 (b) values (1);
+insert t1 (b) values (1);
+insert t1 (b) values (1);
+insert t1 (b) values (1);
+insert t1 (b) values (1);
+select * from t1;                                                               
+drop table t1;
+create table t1 (a int not null, b int not null auto_increment,
+  primary key(a, b), key(b)) engine=heap;
+insert t1 (a) values (1);
+insert t1 (a) values (1);
+insert t1 (a) values (1);
+insert t1 (a) values (1);
+insert t1 (a) values (1);
+insert t1 (a) values (1);
+insert t1 (a) values (1);
+insert t1 (a) values (1);
+select * from t1;                                                               
+drop table t1;
Thread
bk commit into 5.0 tree (ramil:1.1810)ramil15 Mar