List:Commits« Previous MessageNext Message »
From:Chad MILLER Date:November 2 2006 10:27pm
Subject:bk commit into 4.1 tree (cmiller:1.2541)
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of cmiller. When cmiller 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, 2006-11-02 17:27:42-05:00, cmiller@stripped +11 -0
  Merge bk-internal.mysql.com:/home/bk/mysql-4.1
  into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-4.1-maint
  MERGE: 1.2522.18.82

  configure.in@stripped, 2006-11-02 17:20:32-05:00, cmiller@stripped +0 -0
    Auto merged
    MERGE: 1.416.1.1

  myisam/sort.c@stripped, 2006-11-02 17:27:41-05:00, cmiller@stripped +1 -2
    Manual merge.
    MERGE: 1.46.1.1

  mysql-test/r/innodb_mysql.result@stripped, 2006-11-02 17:27:41-05:00, cmiller@stripped +0 -1
    Manual merge.
    MERGE: 1.5.1.1

  mysql-test/t/innodb_mysql.test@stripped, 2006-11-02 17:27:41-05:00, cmiller@stripped +1 -1
    Manual merge.
    MERGE: 1.5.1.1

  mysql-test/t/ps.test@stripped, 2006-11-02 17:20:32-05:00, cmiller@stripped +0 -0
    Auto merged
    MERGE: 1.52.1.1

  mysys/mf_iocache.c@stripped, 2006-11-02 17:27:41-05:00, cmiller@stripped +16 -18
    Manual merge.
    MERGE: 1.48.1.1

  sql/handler.cc@stripped, 2006-11-02 17:20:32-05:00, cmiller@stripped +0 -0
    Auto merged
    MERGE: 1.172.1.1

  sql/sql_delete.cc@stripped, 2006-11-02 17:20:32-05:00, cmiller@stripped +0 -0
    Auto merged
    MERGE: 1.139.2.1

  sql/sql_select.cc@stripped, 2006-11-02 17:20:32-05:00, cmiller@stripped +0 -0
    Auto merged
    MERGE: 1.459.4.1

  sql/table.cc@stripped, 2006-11-02 17:20:33-05:00, cmiller@stripped +0 -0
    Auto merged
    MERGE: 1.137.1.3

  tests/mysql_client_test.c@stripped, 2006-11-02 17:20:33-05:00, cmiller@stripped +0 -0
    Auto merged
    MERGE: 1.170.1.2

# 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:	cmiller
# Host:	zippy.cornsilk.net
# Root:	/home/cmiller/work/mysql/mysql-4.1-maint/RESYNC

--- 1.417/configure.in	2006-11-02 17:27:46 -05:00
+++ 1.418/configure.in	2006-11-02 17:27:46 -05:00
@@ -5,7 +5,7 @@ AC_INIT(sql/mysqld.cc)
 AC_CANONICAL_SYSTEM
 # The Docs Makefile.am parses this line!
 # remember to also change ndb version below and update version.c in ndb
-AM_INIT_AUTOMAKE(mysql, 4.1.22)
+AM_INIT_AUTOMAKE(mysql, 4.1.23)
 AM_CONFIG_HEADER(config.h)
 
 PROTOCOL_VERSION=10
@@ -17,7 +17,7 @@ SHARED_LIB_VERSION=$SHARED_LIB_MAJOR_VER
 # ndb version
 NDB_VERSION_MAJOR=4
 NDB_VERSION_MINOR=1
-NDB_VERSION_BUILD=22
+NDB_VERSION_BUILD=23
 NDB_VERSION_STATUS=""
 
 # Set all version vars based on $VERSION. How do we do this more elegant ?

--- 1.48/myisam/sort.c	2006-11-02 17:27:46 -05:00
+++ 1.49/myisam/sort.c	2006-11-02 17:27:46 -05:00
@@ -327,7 +327,7 @@ pthread_handler_decl(thr_find_all_keys,a
   if (sort_param->sort_info->got_error)
     goto err;
 
-  if (sort_param->keyinfo->flag && HA_VAR_LENGTH_KEY)
+  if (sort_param->keyinfo->flag & HA_VAR_LENGTH_KEY)
   {
     sort_param->write_keys=     write_keys_varlen;
     sort_param->read_to_buffer= read_to_buffer_varlen;
@@ -539,7 +539,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_p
   {
     if (got_error)
       continue;
-    if (sinfo->keyinfo->flag && HA_VAR_LENGTH_KEY)
+    if (sinfo->keyinfo->flag & HA_VAR_LENGTH_KEY)
     {
       sinfo->write_keys=write_keys_varlen;
       sinfo->read_to_buffer=read_to_buffer_varlen;

--- 1.49/mysys/mf_iocache.c	2006-11-02 17:27:46 -05:00
+++ 1.50/mysys/mf_iocache.c	2006-11-02 17:27:46 -05:00
@@ -439,11 +439,24 @@ int _my_b_read(register IO_CACHE *info, 
 
   /* pos_in_file always point on where info->buffer was read */
   pos_in_file=info->pos_in_file+(uint) (info->read_end - info->buffer);
+
+  /* 
+    Whenever a function which operates on IO_CACHE flushes/writes
+    some part of the IO_CACHE to disk it will set the property
+    "seek_not_done" to indicate this to other functions operating
+    on the IO_CACHE.
+  */
   if (info->seek_not_done)
-  {					/* File touched, do seek */
-    VOID(my_seek(info->file,pos_in_file,MY_SEEK_SET,MYF(0)));
+  {
+    if (my_seek(info->file,pos_in_file,MY_SEEK_SET,MYF(0)) 
+        == MY_FILEPOS_ERROR)
+    {
+        info->error= -1;
+        DBUG_RETURN(1);
+    }
     info->seek_not_done=0;
   }
+
   diff_length=(uint) (pos_in_file & (IO_SIZE-1));
   if (Count >= (uint) (IO_SIZE+(IO_SIZE-diff_length)))
   {					/* Fill first intern buffer */
@@ -944,8 +957,22 @@ int _my_b_read_r(register IO_CACHE *cach
         len= 0;
       else
       {
-        if (cache->seek_not_done)             /* File touched, do seek */
-          VOID(my_seek(cache->file, pos_in_file, MY_SEEK_SET, MYF(0)));
+        /*
+          Whenever a function which operates on IO_CACHE flushes/writes
+          some part of the IO_CACHE to disk it will set the property
+          "seek_not_done" to indicate this to other functions operating
+          on the IO_CACHE.
+        */
+        if (info->seek_not_done)
+        {
+          if (my_seek(info->file,pos_in_file,MY_SEEK_SET,MYF(0))
+              == MY_FILEPOS_ERROR)
+          {
+            info->error= -1;
+            unlock_io_cache(info);
+            DBUG_RETURN(1);
+          }
+        }
         len= (int) my_read(cache->file, cache->buffer, length, cache->myflags);
       }
       DBUG_PRINT("io_cache_share", ("read %d bytes", len));
@@ -1047,11 +1074,16 @@ static void copy_to_read_buffer(IO_CACHE
 
 
 /*
-  Do sequential read from the SEQ_READ_APPEND cache
-  we do this in three stages:
+  Do sequential read from the SEQ_READ_APPEND cache.
+  
+  We do this in three stages:
    - first read from info->buffer
    - then if there are still data to read, try the file descriptor
    - afterwards, if there are still data to read, try append buffer
+
+  RETURNS
+    0  Success
+    1  Failed to read
 */
 
 int _my_b_seq_read(register IO_CACHE *info, byte *Buffer, uint Count)
@@ -1079,7 +1111,13 @@ int _my_b_seq_read(register IO_CACHE *in
     With read-append cache we must always do a seek before we read,
     because the write could have moved the file pointer astray
   */
-  VOID(my_seek(info->file,pos_in_file,MY_SEEK_SET,MYF(0)));
+  if (my_seek(info->file,pos_in_file,MY_SEEK_SET,MYF(0))
+      == MY_FILEPOS_ERROR)
+  {
+   info->error= -1;
+   unlock_append_buffer(info);
+   return (1);
+  }
   info->seek_not_done=0;
 
   diff_length=(uint) (pos_in_file & (IO_SIZE-1));
@@ -1195,6 +1233,21 @@ read_append_buffer:
 
 #ifdef HAVE_AIOWAIT
 
+/*
+  Read from the IO_CACHE into a buffer and feed asynchronously
+  from disk when needed.
+
+  SYNOPSIS
+    _my_b_async_read()
+      info                      IO_CACHE pointer
+      Buffer                    Buffer to retrieve count bytes from file
+      Count                     Number of bytes to read into Buffer
+
+  RETURN VALUE
+    -1          An error has occurred; my_errno is set.
+     0          Success
+     1          An error has occurred; IO_CACHE to error state.
+*/
 int _my_b_async_read(register IO_CACHE *info, byte *Buffer, uint Count)
 {
   uint length,read_length,diff_length,left_length,use_length,org_Count;
@@ -1285,7 +1338,14 @@ int _my_b_async_read(register IO_CACHE *
       info->error=(int) (read_length+left_length);
       return 1;
     }
-    VOID(my_seek(info->file,next_pos_in_file,MY_SEEK_SET,MYF(0)));
+    
+    if (my_seek(info->file,next_pos_in_file,MY_SEEK_SET,MYF(0))
+        == MY_FILEPOS_ERROR)
+    {
+      info->error= -1;
+      return (1);
+    }
+
     read_length=IO_SIZE*2- (uint) (next_pos_in_file & (IO_SIZE-1));
     if (Count < read_length)
     {					/* Small block, read to cache */
@@ -1378,7 +1438,15 @@ int _my_b_get(IO_CACHE *info)
   return (int) (uchar) buff;
 }
 
-	/* Returns != 0 if error on write */
+/* 
+   Write a byte buffer to IO_CACHE and flush to disk
+   if IO_CACHE is full.
+
+   RETURN VALUE
+    1 On error on write
+    0 On success
+   -1 On error; my_errno contains error code.
+*/
 
 int _my_b_write(register IO_CACHE *info, const byte *Buffer, uint Count)
 {
@@ -1402,8 +1470,18 @@ int _my_b_write(register IO_CACHE *info,
   {					/* Fill first intern buffer */
     length=Count & (uint) ~(IO_SIZE-1);
     if (info->seek_not_done)
-    {					/* File touched, do seek */
-      VOID(my_seek(info->file,info->pos_in_file,MY_SEEK_SET,MYF(0)));
+    {
+      /*
+        Whenever a function which operates on IO_CACHE flushes/writes
+        some part of the IO_CACHE to disk it will set the property
+        "seek_not_done" to indicate this to other functions operating
+        on the IO_CACHE.
+      */
+      if (my_seek(info->file,info->pos_in_file,MY_SEEK_SET,MYF(0)))
+      {
+        info->error= -1;
+        return (1);
+      }
       info->seek_not_done=0;
     }
     if (my_write(info->file,Buffer,(uint) length,info->myflags | MY_NABP))

--- 1.176/sql/handler.cc	2006-11-02 17:27:46 -05:00
+++ 1.177/sql/handler.cc	2006-11-02 17:27:46 -05:00
@@ -648,7 +648,7 @@ int ha_rollback_trans(THD *thd, THD_TRAN
     }
 #endif
 #ifdef HAVE_INNOBASE_DB
-    if (trans->innobase_tid)
+    if (thd->transaction.all.innodb_active_trans)
     {
       if ((error=innobase_rollback(thd, trans->innobase_tid)))
       {

--- 1.141/sql/sql_delete.cc	2006-11-02 17:27:46 -05:00
+++ 1.142/sql/sql_delete.cc	2006-11-02 17:27:46 -05:00
@@ -84,6 +84,14 @@ int mysql_delete(THD *thd, TABLE_LIST *t
     /* Handler didn't support fast delete; Delete rows one by one */
   }
 
+  if (conds)
+  {
+    Item::cond_result result;
+    conds= remove_eq_conds(thd, conds, &result);
+    if (result == Item::COND_FALSE)             // Impossible where
+      limit= 0;
+  }
+
   table->used_keys.clear_all();
   table->quick_keys.clear_all();		// Can't use 'only index'
   select=make_select(table,0,0,conds,&error);

--- 1.464/sql/sql_select.cc	2006-11-02 17:27:46 -05:00
+++ 1.465/sql/sql_select.cc	2006-11-02 17:27:46 -05:00
@@ -7363,7 +7363,7 @@ part_of_refkey(TABLE *table,Field *field
 
     for (uint part=0 ; part < ref_parts ; part++,key_part++)
       if (field->eq(key_part->field) &&
-	  !(key_part->key_part_flag & HA_PART_KEY_SEG))
+	  !(key_part->key_part_flag & (HA_PART_KEY_SEG | HA_NULL_PART)))
 	return table->reginfo.join_tab->ref.items[part];
   }
   return (Item*) 0;

--- 1.139/sql/table.cc	2006-11-02 17:27:46 -05:00
+++ 1.140/sql/table.cc	2006-11-02 17:27:46 -05:00
@@ -690,7 +690,7 @@ int openfrm(const char *name, const char
 	    as we need to test for NULL = NULL.
 	  */
 	  if (field->real_maybe_null())
-	    key_part->key_part_flag|= HA_PART_KEY_SEG;
+	    key_part->key_part_flag|= HA_NULL_PART;
 	}
 	else
 	{					// Error: shorten key

--- 1.6/mysql-test/r/innodb_mysql.result	2006-11-02 17:27:46 -05:00
+++ 1.7/mysql-test/r/innodb_mysql.result	2006-11-02 17:27:46 -05:00
@@ -104,6 +104,21 @@ SELECT `id1` FROM `t1` WHERE `id1` NOT I
 id1
 2
 DROP TABLE t1, t2;
+DROP TABLE IF EXISTS t2, t1;
+CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE= InnoDB;
+CREATE TABLE t2 (
+i INT NOT NULL,
+FOREIGN KEY (i) REFERENCES t1 (i) ON DELETE NO ACTION
+) ENGINE= InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+DELETE IGNORE FROM t1 WHERE i = 1;
+Warnings:
+Error	1217	Cannot delete or update a parent row: a foreign key constraint fails
+SELECT * FROM t1, t2;
+i	i
+1	1
+DROP TABLE t2, t1;
 flush status;
 create table t1 (c1 int) engine=innodb;
 handler t1 open;

--- 1.6/mysql-test/t/innodb_mysql.test	2006-11-02 17:27:46 -05:00
+++ 1.7/mysql-test/t/innodb_mysql.test	2006-11-02 17:27:46 -05:00
@@ -117,6 +117,35 @@ INSERT INTO `t2`(`id1`,`id2`,`id3`,`id4`
 
 SELECT `id1` FROM `t1` WHERE `id1` NOT IN (SELECT `id1` FROM `t2` WHERE `id2` = 1 AND `id3` = 2);
 DROP TABLE t1, t2;
+
+
+#
+# BUG#18819: DELETE IGNORE hangs on foreign key parent delete
+#
+# The bug itself does not relate to InnoDB, but we have to use foreign
+# keys to reproduce it.
+#
+--disable_warnings
+DROP TABLE IF EXISTS t2, t1;
+--enable_warnings
+
+CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE= InnoDB;
+CREATE TABLE t2 (
+  i INT NOT NULL,
+  FOREIGN KEY (i) REFERENCES t1 (i) ON DELETE NO ACTION
+) ENGINE= InnoDB;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+
+DELETE IGNORE FROM t1 WHERE i = 1;
+
+SELECT * FROM t1, t2;
+
+DROP TABLE t2, t1;
+
+
+#
 # Bug #22728 - Handler_rollback value is growing
 #
 flush status;

--- 1.53/mysql-test/t/ps.test	2006-11-02 17:27:46 -05:00
+++ 1.54/mysql-test/t/ps.test	2006-11-02 17:27:46 -05:00
@@ -951,6 +951,7 @@ execute stmt;
 drop temporary table t1;
 deallocate prepare stmt;
 
+
 #
 # BUG#22085: Crash on the execution of a prepared statement that
 #            uses an IN subquery with aggregate functions in HAVING 
@@ -1003,4 +1004,76 @@ EXECUTE STMT USING @id,@id;
 DEALLOCATE PREPARE STMT;
 DROP TABLE t1;
 
-# End of 4.1 tests
+
+#
+# BUG#21354: (COUNT(*) = 1) not working in SELECT inside prepared
+# statement 
+#
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (i INT, INDEX(i));
+INSERT INTO t1 VALUES (1);
+
+PREPARE stmt FROM "SELECT (COUNT(i) = 1), COUNT(i) FROM t1 WHERE i = ?";
+SET @a = 0;
+EXECUTE stmt USING @a;
+SET @a = 1;
+EXECUTE stmt USING @a;
+SET @a = 0;
+EXECUTE stmt USING @a;
+
+PREPARE stmt FROM "SELECT (AVG(i) = 1), AVG(i) FROM t1 WHERE i = ?";
+SET @a = 0;
+EXECUTE stmt USING @a;
+SET @a = 1;
+EXECUTE stmt USING @a;
+SET @a = 0;
+EXECUTE stmt USING @a;
+
+PREPARE stmt FROM "SELECT (VARIANCE(i) = 1), VARIANCE(i) FROM t1 WHERE i = ?";
+SET @a = 0;
+EXECUTE stmt USING @a;
+SET @a = 1;
+EXECUTE stmt USING @a;
+SET @a = 0;
+EXECUTE stmt USING @a;
+
+PREPARE stmt FROM "SELECT (STDDEV(i) = 1), STDDEV(i) FROM t1 WHERE i = ?";
+SET @a = 0;
+EXECUTE stmt USING @a;
+SET @a = 1;
+EXECUTE stmt USING @a;
+SET @a = 0;
+EXECUTE stmt USING @a;
+
+PREPARE stmt FROM "SELECT (BIT_OR(i) = 1), BIT_OR(i) FROM t1 WHERE i = ?";
+SET @a = 0;
+EXECUTE stmt USING @a;
+SET @a = 1;
+EXECUTE stmt USING @a;
+SET @a = 0;
+EXECUTE stmt USING @a;
+
+PREPARE stmt FROM "SELECT (BIT_AND(i) = 1), BIT_AND(i) FROM t1 WHERE i = ?";
+SET @a = 0;
+EXECUTE stmt USING @a;
+SET @a = 1;
+EXECUTE stmt USING @a;
+SET @a = 0;
+EXECUTE stmt USING @a;
+
+PREPARE stmt FROM "SELECT (BIT_XOR(i) = 1), BIT_XOR(i) FROM t1 WHERE i = ?";
+SET @a = 0;
+EXECUTE stmt USING @a;
+SET @a = 1;
+EXECUTE stmt USING @a;
+SET @a = 0;
+EXECUTE stmt USING @a;
+
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+
+
+--echo End of 4.1 tests.

--- 1.171/tests/mysql_client_test.c	2006-11-02 17:27:46 -05:00
+++ 1.172/tests/mysql_client_test.c	2006-11-02 17:27:46 -05:00
@@ -113,7 +113,9 @@ static void client_disconnect();
 
 void die(const char *file, int line, const char *expr)
 {
+  fflush(stdout);
   fprintf(stderr, "%s:%d: check failed: '%s'\n", file, line, expr);
+  fflush(stderr);
   abort();
 }
 
@@ -11776,6 +11778,7 @@ static void test_bug11718()
     printf("return type: %s", (res->fields[0].type == MYSQL_TYPE_DATE)?"DATE":
            "not DATE");
   DIE_UNLESS(res->fields[0].type == MYSQL_TYPE_DATE);
+  mysql_free_result(res);
   rc= mysql_query(mysql, "drop table t1, t2");
   myquery(rc);
 }
@@ -11847,6 +11850,7 @@ static void test_bug15613()
   DIE_UNLESS(field[4].length == 255);
   DIE_UNLESS(field[5].length == 255);
   DIE_UNLESS(field[6].length == 255);
+  mysql_free_result(metadata);
 
   /* III. Cleanup */
   rc= mysql_query(mysql, "drop table t1");
Thread
bk commit into 4.1 tree (cmiller:1.2541)Chad MILLER2 Nov