List:Internals« Previous MessageNext Message »
From:ingo Date:September 23 2005 3:27pm
Subject:bk commit into 5.0 tree (ingo:1.2001)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of mydev. When mydev 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.2001 05/09/23 17:27:07 ingo@stripped +6 -0
  Merge mysql.com:/home/mydev/mysql-4.1-4100
  into  mysql.com:/home/mydev/mysql-5.0-5000

  mysql-test/t/merge.test
    1.35 05/09/23 17:27:00 ingo@stripped +0 -0
    Auto merged

  mysql-test/r/merge.result
    1.41 05/09/23 17:27:00 ingo@stripped +0 -0
    Auto merged

  myisam/myisamdef.h
    1.79 05/09/23 17:27:00 ingo@stripped +0 -0
    Auto merged

  myisam/mi_search.c
    1.57 05/09/23 17:27:00 ingo@stripped +0 -0
    Auto merged

  myisam/mi_rkey.c
    1.19 05/09/23 17:27:00 ingo@stripped +0 -0
    Auto merged

  myisam/mi_dbug.c
    1.14 05/09/23 17:27:00 ingo@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:	ingo
# Host:	chilla.local
# Root:	/home/mydev/mysql-5.0-5000/RESYNC

--- 1.13/myisam/mi_dbug.c	2004-12-19 19:25:14 +01:00
+++ 1.14/myisam/mi_dbug.c	2005-09-23 17:27:00 +02:00
@@ -40,12 +40,12 @@
     end= key+ keyseg->length;
     if (keyseg->flag & HA_NULL_PART)
     {
-      if (!*key)
+      /* A NULL value is encoded by a 1-byte flag. Zero means NULL. */
+      if (! *(key++))
       {
 	fprintf(stream,"NULL");
 	continue;
       }
-      key++;
     }
 
     switch (keyseg->type) {

--- 1.18/myisam/mi_rkey.c	2004-12-31 02:47:50 +01:00
+++ 1.19/myisam/mi_rkey.c	2005-09-23 17:27:00 +02:00
@@ -31,8 +31,8 @@
   HA_KEYSEG *last_used_keyseg;
   uint pack_key_length, use_key_length, nextflag;
   DBUG_ENTER("mi_rkey");
-  DBUG_PRINT("enter",("base: %lx  inx: %d  search_flag: %d",
-		      info,inx,search_flag));
+  DBUG_PRINT("enter", ("base: %p  buf: %p  inx: %d  search_flag: %d",
+                       info, buf, inx, search_flag));
 
   if ((inx = _mi_check_index(info,inx)) < 0)
     DBUG_RETURN(my_errno);
@@ -56,9 +56,12 @@
   {
     if (key_len == 0)
       key_len=USE_WHOLE_KEY;
+    /* Save the packed key for later use in the second buffer of lastkey. */
     key_buff=info->lastkey+info->s->base.max_key_length;
     pack_key_length=_mi_pack_key(info,(uint) inx, key_buff, (uchar*) key,
 				 key_len, &last_used_keyseg);
+    /* Save packed_key_length for use by the MERGE engine. */
+    info->pack_key_length= pack_key_length;
     DBUG_EXECUTE("key",_mi_print_key(DBUG_FILE, keyinfo->seg,
 				     key_buff, pack_key_length););
   }

--- 1.56/myisam/mi_search.c	2005-08-29 17:38:30 +02:00
+++ 1.57/myisam/mi_search.c	2005-09-23 17:27:00 +02:00
@@ -915,11 +915,21 @@
   reg1 HA_KEYSEG *keyseg;
   uchar *start_key,*page,*page_end,*from,*from_end;
   uint length,tmp;
+  DBUG_ENTER("_mi_get_binary_pack_key");
 
   page= *page_pos;
   page_end=page+MI_MAX_KEY_BUFF+1;
   start_key=key;
 
+  /*
+    Keys are compressed the following way:
+
+    prefix length    Packed length of prefix for the prev key. (1 or 3 bytes)
+    for each key segment:
+      [is null]        Null indicator if can be null (1 byte, zero means null)
+      [length]         Packed length if varlength (1 or 3 bytes)
+    pointer          Reference to the data file (last_keyseg->length).
+  */
   get_key_length(length,page);
   if (length)
   {
@@ -930,7 +940,7 @@
       DBUG_DUMP("key",(char*) *page_pos,16);
       mi_print_error(keyinfo->share, HA_ERR_CRASHED);
       my_errno=HA_ERR_CRASHED;
-      return 0;                                 /* Wrong key */
+      DBUG_RETURN(0);                                 /* Wrong key */
     }
     from=key;  from_end=key+length;
   }
@@ -992,12 +1002,12 @@
       DBUG_PRINT("error",("Error when unpacking key"));
       mi_print_error(keyinfo->share, HA_ERR_CRASHED);
       my_errno=HA_ERR_CRASHED;
-      return 0;                                 /* Error */
+      DBUG_RETURN(0);                                 /* Error */
     }
     memcpy((byte*) key,(byte*) from,(size_t) length);
     *page_pos= from+length;
   }
-  return((uint) (key-start_key)+keyseg->length);
+  DBUG_RETURN((uint) (key-start_key)+keyseg->length);
 }
 
 

--- 1.78/myisam/myisamdef.h	2005-09-05 15:14:09 +02:00
+++ 1.79/myisam/myisamdef.h	2005-09-23 17:27:00 +02:00
@@ -261,6 +261,7 @@
   uint	last_rkey_length;		/* Last length in mi_rkey() */
   enum ha_rkey_function last_key_func;  /* CONTAIN, OVERLAP, etc */
   uint  save_lastkey_length;
+  uint  pack_key_length;                /* For MYISAMMRG */
   int	errkey;				/* Got last error on this key */
   int   lock_type;			/* How database was locked */
   int   tmp_lock_type;			/* When locked by readinfo */

--- 1.40/mysql-test/r/merge.result	2005-05-18 22:51:22 +02:00
+++ 1.41/mysql-test/r/merge.result	2005-09-23 17:27:00 +02:00
@@ -653,6 +653,32 @@
 create table t3 engine=merge union=(t1, t2) select (select max(a) from t2);
 ERROR HY000: You can't specify target table 't2' for update in FROM clause
 drop table t1, t2;
+create table t1 (
+a double(16,6),
+b varchar(10),
+index (a,b)
+) engine=merge union=(t2,t3);
+create table t2 (
+a double(16,6),
+b varchar(10),
+index (a,b)
+) engine=myisam;
+create table t3 (
+a double(16,6),
+b varchar(10),
+index (a,b)
+) engine=myisam;
+insert into t2 values ( null, '');
+insert into t2 values ( 9999999999.999999, '');
+insert into t3 select * from t2;
+select min(a), max(a) from t1;
+min(a)	max(a)
+9999999999.999998	9999999999.999998
+flush tables;
+select min(a), max(a) from t1;
+min(a)	max(a)
+9999999999.999998	9999999999.999998
+drop table t1, t2, t3;
 create table t1 (a int,b int,c int, index (a,b,c));
 create table t2 (a int,b int,c int, index (a,b,c));
 create table t3 (a int,b int,c int, index (a,b,c))

--- 1.34/mysql-test/t/merge.test	2005-07-28 15:12:34 +02:00
+++ 1.35/mysql-test/t/merge.test	2005-09-23 17:27:00 +02:00
@@ -288,6 +288,42 @@
 create table t3 engine=merge union=(t1, t2) select (select max(a) from t2);
 drop table t1, t2;
 
+#
+# Bug#9112 - Merge table with composite index producing invalid results with some queries
+# This test case will fail only without the bugfix and some
+# non-deterministic circumstances. It depends on properly initialized
+# "un-initialized" memory. At the time it happens with a standard
+# non-debug build. But there is no guarantee that this will be always so.
+#
+create table t1 (
+ a double(16,6),
+ b varchar(10),
+ index (a,b)
+) engine=merge union=(t2,t3);
+
+create table t2 (
+ a double(16,6),
+ b varchar(10),
+ index (a,b)
+) engine=myisam;
+
+create table t3 (
+ a double(16,6),
+ b varchar(10),
+ index (a,b)
+) engine=myisam;
+
+insert into t2 values ( null, '');
+# We may have insufficient accuracy for 16 digits of '9'.
+# Suppress a "truncate" warning due to accuracy problems.
+--disable_warnings
+insert into t2 values ( 9999999999.999999, '');
+--enable_warnings
+insert into t3 select * from t2;
+select min(a), max(a) from t1;
+flush tables;
+select min(a), max(a) from t1;
+drop table t1, t2, t3;
 # BUG#6699 : no sorting on 'ref' retrieval 
 create table t1 (a int,b int,c int, index (a,b,c));
 create table t2 (a int,b int,c int, index (a,b,c));
Thread
bk commit into 5.0 tree (ingo:1.2001)ingo23 Sep