List:Commits« Previous MessageNext Message »
From:<"Patrick Galbraith" Date:December 30 2005 12:14am
Subject:bk commit into 5.1 tree (patg:1.2007)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of patg. When patg 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.2007 05/12/29 16:14:42 patg@stripped +1 -0
  WL# 2682 More changes in WL implementation.

  sql/ha_partition.cc
    1.19 05/12/29 16:14:33 patg@stripped +46 -37
    WL# 2682 More changes/progress, made sure all loops check bitmap.

# 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:	patg
# Host:	govinda.site
# Root:	/home/patg/mysql-build/mysql-5.1-wl2682

--- 1.18/sql/ha_partition.cc	2005-12-28 14:32:24 -08:00
+++ 1.19/sql/ha_partition.cc	2005-12-29 16:14:33 -08:00
@@ -1150,16 +1150,17 @@
   bitmap_set_all(&(m_part_info->used_partitions));  // TODO:  remove this once the pruning patch goes in
   if (thd->lex->part_info)
   {
+    int index;
     bitmap_clear_all(&(m_part_info->used_partitions));
-    uint index= get_partition_index(thd->lex->part_info->selected_partition);
-//    uint retval=0;
-  //  retval= is_partition_in_table(share, thd->lex->part_info->selected_partition); 
+    index= get_partition_index(thd->lex->part_info->selected_partition);
+    //    uint retval=0; retval= is_partition_in_table(share,
+    //    thd->lex->part_info->selected_partition); 
     if (index >= 0)
     {
       DBUG_PRINT("info", ("selected partition %s is in table",
                           thd->lex->part_info->selected_partition));
       bitmap_set_bit(&(m_part_info->used_partitions), index);
-	}
+    }
     else
     {
       my_error(ER_NO_SUCH_PARTITION, MYF(0),
@@ -1171,26 +1172,26 @@
   //file= m_file;
 
   int i= 0;
-  for (i= 0; i < m_part_info->no_parts; i++)
+  for (i= 0; i < (int) m_part_info->no_parts; i++)
   {
     if (_bitmap_is_set(&(m_part_info->used_partitions), i))
-	  if (error= m_file[i]->external_lock(thd, lock_type))
-	  {
+      if ((error= m_file[i]->external_lock(thd, lock_type)))
+      {
         DBUG_PRINT("info", ("(file)->s->table_name.str", (*file)->table_share->table_name.str));
         if (lock_type != F_UNLCK)
-	      goto err_handler;
-	  }
+          goto err_handler;
+      }
   }
 
-/*  do
-  {
+  /*  do
+    {
     if ((error= (*file)->external_lock(thd, lock_type)))
     {
-      DBUG_PRINT("info", ("(file)->s->table_name.str", (*file)->table_share->table_name.str));
-      if (lock_type != F_UNLCK)
-	goto err_handler;
+    DBUG_PRINT("info", ("(file)->s->table_name.str", (*file)->table_share->table_name.str));
+    if (lock_type != F_UNLCK)
+    goto err_handler;
     }
-  } while (*(++file));*/
+    } while (*(++file));*/
   m_lock_type= lock_type;                       // For the future (2009?)
   DBUG_RETURN(0);
 
@@ -1198,11 +1199,11 @@
   while (i >= 0)
   {
     if (_bitmap_is_set(&(m_part_info->used_partitions), i))
-	  m_file[i--]->external_lock(thd, F_UNLCK);
+      m_file[i--]->external_lock(thd, F_UNLCK);
   }
 
   //while (file-- != m_file)
-    //(*file)->external_lock(thd, F_UNLCK);
+  //(*file)->external_lock(thd, F_UNLCK);
   DBUG_RETURN(error);
 }
 
@@ -1552,6 +1553,7 @@
 int ha_partition::rnd_init(bool scan)
 {
   int error;
+  int i= 0;
   handler **file;
   DBUG_ENTER("ha_partition::rnd_init");
 
@@ -1582,15 +1584,16 @@
     m_scan_value= 1;                            // Scan active
     if (error)
       m_scan_value= 2;                          // No scan active
+
+    DBUG_PRINT("info", ("if scan && 0 m_scan_value %d", m_scan_value));
     DBUG_RETURN(error);
   }
 
-  int i= 0;
   for (i= 0; i < m_part_info->no_parts; i++)
   {
     if (_bitmap_is_set(&(m_part_info->used_partitions), i))
-	  if (error= m_file[i]->ha_rnd_init(scan))
-	    goto err;
+      if (error= m_file[i]->ha_rnd_init(scan))
+        goto err;
   }
 
 
@@ -1601,6 +1604,7 @@
 //      goto err;
 //  } while (*(++file));
   m_scan_value= 0;
+  DBUG_PRINT("info", ("m_scan_value %d", m_scan_value));
   DBUG_RETURN(0);
 
 err:
@@ -1630,11 +1634,13 @@
     }
     break;
   case 0:
+    int i=0;
     file= m_file;
-    do
+    for (i= 0; i < m_part_info->no_parts; i++)
     {
-      (*file)->ha_rnd_end();
-    } while (*(++file));
+      if (_bitmap_is_set(&(m_part_info->used_partitions), i))
+        m_file[i]->ha_rnd_end();
+    }
     break;
   }
   m_part_spec.start_part= NO_CURRENT_PART_ID;
@@ -1666,6 +1672,7 @@
   handler *file= m_file[part_id];
   int result= HA_ERR_END_OF_FILE;
   DBUG_ENTER("ha_partition::rnd_next");
+  DBUG_PRINT("info", ("m_scan_value %d", m_scan_value));
 
   DBUG_ASSERT(m_scan_value == 1);
 
@@ -1812,6 +1819,7 @@
 int ha_partition::index_init(uint inx, bool sorted)
 {
   int error= 0;
+  int i= 0;
   handler **file;
   DBUG_ENTER("ha_partition::index_init");
 
@@ -1821,17 +1829,17 @@
   m_ordered= sorted;
   m_curr_key_info= table->key_info+inx;
   include_partition_fields_in_used_fields();
-
   file= m_file;
-  do
+  for (i= 0; i < m_part_info->no_parts; i++)
   {
     /* TODO RONM: Change to index_init() when code is stable */
-    if ((error= (*file)->ha_index_init(inx, sorted)))
-    {
-      DBUG_ASSERT(0);                           // Should never happen
-      break;
-    }
-  } while (*(++file));
+    if (_bitmap_is_set(&(m_part_info->used_partitions), i))
+      if (error= m_file[i]->ha_index_init(inx, sorted))
+      {
+        DBUG_ASSERT(0);                           // Should never happen
+        break;
+      }
+  }
   DBUG_RETURN(error);
 }
 
@@ -1844,20 +1852,21 @@
 int ha_partition::index_end()
 {
   int error= 0;
+  int i= 0;
   handler **file;
   DBUG_ENTER("ha_partition::index_end");
 
   active_index= MAX_KEY;
   m_part_spec.start_part= NO_CURRENT_PART_ID;
   file= m_file;
-  do
+  for (i= 0; i < m_part_info->no_parts; i++)
   {
     int tmp;
-    /* We want to execute index_end() on all handlers */
-    /* TODO RONM: Change to index_end() when code is stable */
-    if ((tmp= (*file)->ha_index_end()))
-      error= tmp;
-  } while (*(++file));
+    /* TODO RONM: Change to index_init() when code is stable */
+    if (_bitmap_is_set(&(m_part_info->used_partitions), i))
+      if (tmp= m_file[i]->ha_index_end())
+        error= tmp;
+  }
   DBUG_RETURN(error);
 }
 
Thread
bk commit into 5.1 tree (patg:1.2007)"Patrick Galbraith"30 Dec