List:Commits« Previous MessageNext Message »
From:Stewart Smith Date:October 16 2006 7:15am
Subject:bk commit into 5.0 tree (stewart:1.2265)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of stewart. When stewart 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-10-16 17:14:58+10:00, stewart@willster.(none) +7 -0
  Merge willster.(none):/home/stewart/Documents/MySQL/5.0/ndb
  into  willster.(none):/home/stewart/Documents/MySQL/5.0/bug19914-mk2
  MERGE: 1.2248.57.6

  sql/ha_archive.cc@stripped, 2006-10-16 17:14:53+10:00, stewart@willster.(none) +0 -0
    Auto merged
    MERGE: 1.72.1.2

  sql/ha_archive.h@stripped, 2006-10-16 17:14:53+10:00, stewart@willster.(none) +0 -0
    Auto merged
    MERGE: 1.33.1.1

  sql/ha_innodb.cc@stripped, 2006-10-16 17:14:53+10:00, stewart@willster.(none) +0 -0
    Auto merged
    MERGE: 1.299.1.1

  sql/ha_myisammrg.cc@stripped, 2006-10-16 17:14:53+10:00, stewart@willster.(none) +0 -0
    Auto merged
    MERGE: 1.80.1.2

  sql/ha_ndbcluster.cc@stripped, 2006-10-16 17:14:53+10:00, stewart@willster.(none) +0 -0
    Auto merged
    MERGE: 1.277.2.4

  sql/item_sum.cc@stripped, 2006-10-16 17:14:53+10:00, stewart@willster.(none) +0 -0
    Auto merged
    MERGE: 1.180.1.1

  sql/sql_select.cc@stripped, 2006-10-16 17:14:53+10:00, stewart@willster.(none) +0 -0
    Auto merged
    MERGE: 1.454.1.4

# 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:	stewart
# Host:	willster.(none)
# Root:	/home/stewart/Documents/MySQL/5.0/bug19914-mk2/RESYNC

--- 1.81/sql/ha_myisammrg.cc	2006-10-16 17:15:03 +10:00
+++ 1.82/sql/ha_myisammrg.cc	2006-10-16 17:15:03 +10:00
@@ -326,9 +326,22 @@
   if (flag & HA_STATUS_CONST)
   {
     if (table->s->key_parts && info.rec_per_key)
+    {
+#ifdef HAVE_purify
+      /*
+        valgrind may be unhappy about it, because optimizer may access values
+        between file->keys and table->key_parts, that will be uninitialized.
+        It's safe though, because even if opimizer will decide to use a key
+        with such a number, it'll be an error later anyway.
+      */
+      bzero((char*) table->key_info[0].rec_per_key,
+            sizeof(table->key_info[0].rec_per_key) * table->s->key_parts);
+#endif
       memcpy((char*) table->key_info[0].rec_per_key,
 	     (char*) info.rec_per_key,
-	     sizeof(table->key_info[0].rec_per_key)*table->s->key_parts);
+             sizeof(table->key_info[0].rec_per_key) *
+             min(file->keys, table->s->key_parts));
+    }
   }
   return 0;
 }

--- 1.181/sql/item_sum.cc	2006-10-16 17:15:03 +10:00
+++ 1.182/sql/item_sum.cc	2006-10-16 17:15:03 +10:00
@@ -2675,6 +2675,7 @@
 
 longlong Item_sum_count_distinct::val_int()
 {
+  int error;
   DBUG_ASSERT(fixed == 1);
   if (!table)					// Empty query
     return LL(0);
@@ -2688,7 +2689,14 @@
     tree->walk(count_distinct_walk, (void*) &count);
     return (longlong) count;
   }
-  table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
+
+  error= table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
+
+  if(error)
+  {
+    table->file->print_error(error, MYF(0));
+  }
+
   return table->file->records;
 }
 

--- 1.462/sql/sql_select.cc	2006-10-16 17:15:03 +10:00
+++ 1.463/sql/sql_select.cc	2006-10-16 17:15:03 +10:00
@@ -666,6 +666,8 @@
     {
       if (res > 1)
       {
+        thd->fatal_error();
+        error= res;
         DBUG_PRINT("error",("Error from opt_sum_query"));
 	DBUG_RETURN(1);
       }
@@ -2102,7 +2104,12 @@
     s->needed_reg.init();
     table_vector[i]=s->table=table=tables->table;
     table->pos_in_table_list= tables;
-    table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);// record count
+    error= table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
+    if(error)
+    {
+        table->file->print_error(error, MYF(0));
+        DBUG_RETURN(1);
+    }
     table->quick_keys.clear_all();
     table->reginfo.join_tab=s;
     table->reginfo.not_exists_optimize=0;

--- 1.73/sql/ha_archive.cc	2006-10-16 17:15:03 +10:00
+++ 1.74/sql/ha_archive.cc	2006-10-16 17:15:03 +10:00
@@ -120,6 +120,8 @@
 /* Variables for archive share methods */
 pthread_mutex_t archive_mutex;
 static HASH archive_open_tables;
+static z_off_t max_zfile_size;
+static int zoffset_size;
 
 /* The file extension */
 #define ARZ ".ARZ"               // The data file
@@ -203,6 +205,18 @@
   }
   else
   {
+    zoffset_size= 2 << ((zlibCompileFlags() >> 6) & 3);
+    switch (sizeof(z_off_t)) {
+    case 2:
+      max_zfile_size= INT_MAX16;
+      break;
+    case 8:
+      max_zfile_size= LONGLONG_MAX;
+      break;
+    case 4:
+    default:
+      max_zfile_size= INT_MAX32;
+    }
     archive_inited= TRUE;
     DBUG_RETURN(FALSE);
   }
@@ -240,7 +254,7 @@
   buffer.set((char *)byte_buffer, IO_SIZE, system_charset_info);
 
   /* The size of the offset value we will use for position() */
-  ref_length = 2 << ((zlibCompileFlags() >> 6) & 3);
+  ref_length = zoffset_size;
   DBUG_ASSERT(ref_length <= sizeof(z_off_t));
 }
 
@@ -480,7 +494,8 @@
     DBUG_RETURN(1);
   }
   share->archive_write_open= TRUE;
-
+  info(HA_STATUS_TIME);
+  share->approx_file_size= data_file_length;
   DBUG_RETURN(0);
 }
 
@@ -651,10 +666,21 @@
 */
 int ha_archive::real_write_row(byte *buf, gzFile writer)
 {
-  z_off_t written;
+  z_off_t written, total_row_length;
   uint *ptr, *end;
   DBUG_ENTER("ha_archive::real_write_row");
-
+  total_row_length= table->s->reclength;
+  for (ptr= table->s->blob_field, end= ptr + table->s->blob_fields;
+       ptr != end; ptr++)
+    total_row_length+= ((Field_blob*) table->field[*ptr])->get_length();
+  if (share->approx_file_size > max_zfile_size - total_row_length)
+  {
+    info(HA_STATUS_TIME);
+    share->approx_file_size= data_file_length;
+    if (share->approx_file_size > max_zfile_size - total_row_length)
+      DBUG_RETURN(HA_ERR_RECORD_FILE_FULL);
+  }
+  share->approx_file_size+= total_row_length;
   written= gzwrite(writer, buf, table->s->reclength);
   DBUG_PRINT("ha_archive::real_write_row", ("Wrote %d bytes expected %d", written, table->s->reclength));
   if (!delayed_insert || !bulk_insert)

--- 1.34/sql/ha_archive.h	2006-10-16 17:15:03 +10:00
+++ 1.35/sql/ha_archive.h	2006-10-16 17:15:03 +10:00
@@ -38,6 +38,7 @@
   bool dirty;               /* Flag for if a flush should occur */
   bool crashed;             /* Meta file is crashed */
   ha_rows rows_recorded;    /* Number of rows in tables */
+  z_off_t approx_file_size; /* Approximate archive data file size */
 } ARCHIVE_SHARE;
 
 /*

--- 1.280/sql/ha_ndbcluster.cc	2006-10-16 17:15:03 +10:00
+++ 1.281/sql/ha_ndbcluster.cc	2006-10-16 17:15:03 +10:00
@@ -355,11 +355,13 @@
   DBUG_VOID_RETURN;
 }
 
-void ha_ndbcluster::records_update()
+int ha_ndbcluster::records_update()
 {
   if (m_ha_not_exact_count)
-    return;
+    return 0;
   DBUG_ENTER("ha_ndbcluster::records_update");
+  int result= 0;
+
   struct Ndb_local_table_statistics *info= 
     (struct Ndb_local_table_statistics *)m_table_info;
   DBUG_PRINT("info", ("id=%d, no_uncommitted_rows_count=%d",
@@ -370,7 +372,7 @@
     Ndb *ndb= get_ndb();
     struct Ndb_statistics stat;
     ndb->setDatabaseName(m_dbname);
-    if (ndb_get_table_statistics(ndb, m_tabname, &stat) == 0){
+    if ((result= ndb_get_table_statistics(ndb, m_tabname, &stat)) == 0){
       mean_rec_length= stat.row_size;
       data_file_length= stat.fragment_memory;
       info->records= stat.row_count;
@@ -382,7 +384,7 @@
       info->no_uncommitted_rows_count= 0;
   }
   records= info->records+ info->no_uncommitted_rows_count;
-  DBUG_VOID_RETURN;
+  DBUG_RETURN(result);
 }
 
 void ha_ndbcluster::no_uncommitted_rows_execute_failure()
@@ -3086,8 +3088,9 @@
 }
 
 
-void ha_ndbcluster::info(uint flag)
+int ha_ndbcluster::info(uint flag)
 {
+  int result= 0;
   DBUG_ENTER("info");
   DBUG_PRINT("enter", ("flag: %d", flag));
   
@@ -3105,17 +3108,17 @@
       if (m_ha_not_exact_count)
         records= 100;
       else
-        records_update();
+	result= records_update();
     }
     else
     {
       if ((my_errno= check_ndb_connection()))
-        DBUG_VOID_RETURN;
+        DBUG_RETURN(my_errno);
       Ndb *ndb= get_ndb();
       struct Ndb_statistics stat;
       ndb->setDatabaseName(m_dbname);
       if (current_thd->variables.ndb_use_exact_count &&
-          ndb_get_table_statistics(ndb, m_tabname, &stat) == 0)
+          (result= ndb_get_table_statistics(ndb, m_tabname, &stat)) == 0)
       {
         mean_rec_length= stat.row_size;
         data_file_length= stat.fragment_memory;
@@ -3158,7 +3161,11 @@
         auto_increment_value= (ulonglong)auto_increment_value64;
     }
   }
-  DBUG_VOID_RETURN;
+
+  if(result == -1)
+    result= HA_ERR_NO_CONNECTION;
+
+  DBUG_RETURN(result);
 }
 
 

--- 1.300/sql/ha_innodb.cc	2006-10-16 17:15:03 +10:00
+++ 1.301/sql/ha_innodb.cc	2006-10-16 17:15:03 +10:00
@@ -5258,7 +5258,7 @@
 Returns statistics information of the table to the MySQL interpreter,
 in various fields of the handle object. */
 
-void
+int
 ha_innobase::info(
 /*==============*/
 	uint flag)	/* in: what information MySQL requests */
@@ -5281,7 +5281,7 @@
 
         if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) {
 
-                DBUG_VOID_RETURN;
+                DBUG_RETURN(HA_ERR_CRASHED);
         }
 
 	/* We do not know if MySQL can call this function before calling
@@ -5476,7 +5476,7 @@
 
 	prebuilt->trx->op_info = (char*)"";
 
-  	DBUG_VOID_RETURN;
+  	DBUG_RETURN(0);
 }
 
 /**************************************************************************
Thread
bk commit into 5.0 tree (stewart:1.2265)Stewart Smith16 Oct