List:Commits« Previous MessageNext Message »
From:Patrick Galbraith Date:January 18 2006 10:46pm
Subject:bk commit into 5.1 tree (patg:1.2025)
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.2025 06/01/18 14:46:45 patg@stripped +3 -0
  WL# 2682, last changes to this WL, needed to make a patch for WL# 2986

  sql/ha_partition.h
    1.15 06/01/18 14:46:41 patg@stripped +1 -1
    WL# 2682, last changes, to make a patch for WL# 2986

  sql/ha_partition.cc
    1.33 06/01/18 14:46:41 patg@stripped +37 -55
    WL# 2682 - last changes in trying to make a patch for wl# 2986

  mysql-test/t/partition_select.test
    1.5 06/01/18 14:46:41 patg@stripped +2 -2
    WL# 2682 - submitting last changes in order to create a patch for WL# 2986

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

--- 1.32/sql/ha_partition.cc	2006-01-18 08:26:26 -08:00
+++ 1.33/sql/ha_partition.cc	2006-01-18 14:46:41 -08:00
@@ -2244,9 +2244,7 @@
 
   /* Initialze the bitmap we use to determine what partitions are used */
   bitmap_init(&(m_part_info->used_partitions), NULL, m_tot_parts, TRUE);
-  bitmap_init(&(m_part_info->used_partitions_copy), NULL, m_tot_parts, TRUE);
   bitmap_set_all(&(m_part_info->used_partitions));
-  bitmap_set_all(&(m_part_info->used_partitions_copy));
 
   /* Here we stick all of our partition element objects in a hash by name */
   if (populate_partition_name_hash(m_part_info))
@@ -2321,18 +2319,27 @@
 
 int ha_partition::close(void)
 {
+  bool first= TRUE;
   int i;
   handler **file;
-  partition_element *part_elem;
-  List_iterator_fast <partition_element> part_it(m_part_info->partitions);
   DBUG_ENTER("ha_partition::close");
 
-  delete_queue(&queue);
+  delete_queue(&m_queue);
   bitmap_free(&(m_part_info->used_partitions));
   file= m_file;
-  do {
+
+repeat:
+  do
+  {
     (*file)->close();
   } while (*(++file));
+
+  if (first && m_added_file && m_added_file[0])
+  {
+    file= m_added_file;
+    first= FALSE;
+    goto repeat;
+  }
   hash_free(&(m_part_info->partition_names));
 
   DBUG_RETURN(0);
@@ -2380,13 +2387,10 @@
 
 int ha_partition::external_lock(THD *thd, int lock_type)
 {
+  bool first= TRUE;
   uint error;
   handler **file;
   DBUG_ENTER("ha_partition::external_lock");
-  DBUG_PRINT("info", ("m_part_info->used_partitions %lx \
-                      m_part_info->used_partitions_copy %lx",
-                      *m_part_info->used_partitions.bitmap,
-                      *m_part_info->used_partitions_copy.bitmap));
 
   /* if this query specifies a partition, then set the bitmap accordingly */
   if (table->partition_name != NULL)
@@ -2402,13 +2406,14 @@
   {
     bitmap_set_all(&(m_part_info->used_partitions));
   }
-  bitmap_copy(&(m_part_info->used_partitions_copy),
-              &(m_part_info->used_partitions));
 
   file= m_file;
+  m_lock_type= lock_type;
+
+repeat:
   do
   {
-    if (_bitmap_is_set(&(m_part_info->used_partitions_copy), (file - m_file)))
+    if (_bitmap_is_set(&(m_part_info->used_partitions), (file - m_file)))
     {
       if ((error= (*file)->external_lock(thd, lock_type)))
       {
@@ -2417,13 +2422,20 @@
       }
     }
   } while (*(++file));
-  m_lock_type= lock_type;
+
+  if (first && m_added_file && m_added_file[0])
+  {
+    DBUG_ASSERT(lock_type == F_UNLCK);
+    file= m_added_file;
+    first= FALSE;
+    goto repeat;
+  }
   DBUG_RETURN(0);
 
 err_handler:
   while (file-- != m_file)
   {
-    if (_bitmap_is_set(&(m_part_info->used_partitions_copy), (file - m_file)))
+    if (_bitmap_is_set(&(m_part_info->used_partitions), (file - m_file)))
     {
       (*file)->external_lock(thd, F_UNLCK);
     }
@@ -2484,15 +2496,10 @@
 {
   handler **file;
   DBUG_ENTER("ha_partition::store_lock");
-  DBUG_PRINT("info", ("m_part_info->used_partitions %lx \
-                      m_part_info->used_partitions_copy %lx",
-                      *m_part_info->used_partitions.bitmap,
-                      *m_part_info->used_partitions_copy.bitmap));
   file= m_file;
   do
   {
-    if (_bitmap_is_set(&(m_part_info->used_partitions_copy), (file - m_file)))
-      to= (*file)->store_lock(thd, to, lock_type);
+    to= (*file)->store_lock(thd, to, lock_type);
   } while (*(++file));
   DBUG_RETURN(to);
 }
@@ -2518,11 +2525,8 @@
 {
   int i= 0;
   int error= 0;
+  handler **file;
   DBUG_ENTER("ha_partition::start_stmt");
-  DBUG_PRINT("info", ("m_part_info->used_partitions %lx \
-                      m_part_info->used_partitions_copy %lx",
-                      *m_part_info->used_partitions.bitmap,
-                      *m_part_info->used_partitions_copy.bitmap));
 
   /* if this query specifies a partition, then set the bitmap accordingly */
   if (table->partition_name != NULL)
@@ -2538,14 +2542,12 @@
   {
     bitmap_set_all(&(m_part_info->used_partitions));
   }
-  bitmap_copy(&(m_part_info->used_partitions_copy),
-              &(m_part_info->used_partitions));
 
 
-  handler **file= m_file;
+  file= m_file;
   do
   {
-    if (_bitmap_is_set(&(m_part_info->used_partitions_copy), (file - m_file)))
+    if (_bitmap_is_set(&(m_part_info->used_partitions), (file - m_file)))
     {
       if ((error= (*file)->start_stmt(thd, lock_type)))
         break;
@@ -2571,23 +2573,10 @@
     sufficient space for lock structures.
 */
 
-uint ha_partition::lock_count()
+uint ha_partition::lock_count() const
 {
   handler **file= m_file;
   DBUG_ENTER("ha_partition::lock_count");
-  m_no_locks= 0;
-  bitmap_copy(&(m_part_info->used_partitions_copy),
-              &(m_part_info->used_partitions));
-  DBUG_PRINT("info", ("m_part_info->used_partitions %lx \
-                      m_part_info->used_partitions_copy %lx",
-                      *m_part_info->used_partitions.bitmap,
-                      *m_part_info->used_partitions_copy.bitmap));
-  do
-  {
-    if (_bitmap_is_set(&(m_part_info->used_partitions_copy), (file - m_file)))
-      m_no_locks++;
-  } while (*(++file));
-
   DBUG_PRINT("info", ("m_no_locks %d", m_no_locks));
   DBUG_RETURN(m_no_locks);
 }
@@ -2909,8 +2898,7 @@
   do
   {
     int tmp;
-    int i= file - m_file;
-    if (_bitmap_is_set(&(m_part_info->used_partitions), i))
+    if (_bitmap_is_set(&(m_part_info->used_partitions), (file - m_file)))
       if ((tmp= (*file)->end_bulk_insert()))
         error= tmp;
   } while (*(++file));
@@ -3023,11 +3011,9 @@
 
 int ha_partition::rnd_end()
 {
-  int i= 0;
   handler **file;
   DBUG_ENTER("ha_partition::rnd_end");
-  switch (m_scan_value) 
-  {
+  switch (m_scan_value) {
   case 2:                                       // Error
     break;
   case 1:
@@ -3038,7 +3024,6 @@
     }
     break;
   case 0:
-    int i=0;
     file= m_file;
     do
     {
@@ -3170,7 +3155,7 @@
   DBUG_ENTER("ha_partition::position");
 
   file->position(record);
-  store_part_id_in_pos(ref, current_partition_index);
+  //store_part_id_in_pos(ref, current_partition_index);
   memcpy((ref + PARTITION_BYTES_IN_POS), file->ref,
 	 (ref_length - PARTITION_BYTES_IN_POS));
 
@@ -3300,7 +3285,6 @@
 int ha_partition::index_end()
 {
   int error= 0;
-  uint i= 0;
   handler **file;
   DBUG_ENTER("ha_partition::index_end");
 
@@ -3980,7 +3964,7 @@
         /*
           Initialise queue without order first, simply insert
         */
-        queue_element(&queue, j++)= (byte*)queue_buf(i);
+        queue_element(&m_queue, j++)= (byte*)queue_buf(i);
       }
       else if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE)
       {
@@ -4786,7 +4770,6 @@
   file= m_file;
   do
   {
-    DBUG_PRINT("info", ("file iterator %d", (file - m_file) ));
     if ((tmp= (*file)->reset()))
       result= tmp;
   } while (*(++file));
@@ -5024,8 +5007,7 @@
   file= m_file;
   do
   {
-    int i= file - m_file;
-    if (_bitmap_is_set(&(m_part_info->used_partitions), i))
+    if (_bitmap_is_set(&(m_part_info->used_partitions), (file - m_file)))
       in_range+= (*file)->records_in_range(inx, min_key, max_key);
   } while (*(++file));
   DBUG_RETURN(in_range);

--- 1.14/sql/ha_partition.h	2006-01-17 16:39:19 -08:00
+++ 1.15/sql/ha_partition.h	2006-01-18 14:46:41 -08:00
@@ -277,7 +277,7 @@
   /*
     Lock count is number of locked underlying handlers (I assume)
   */
-  virtual uint lock_count(void);
+  virtual uint lock_count(void) const;
   /*
     Call to unlock rows not to be updated in transaction
   */

--- 1.4/mysql-test/t/partition_select.test	2006-01-10 10:10:43 -08:00
+++ 1.5/mysql-test/t/partition_select.test	2006-01-18 14:46:41 -08:00
@@ -26,7 +26,7 @@
 SELECT * FROM t1 PARTITION (p2);
 SELECT * FROM t1 PARTITION (p3);
 SELECT * FROM t1 PARTITION (p3) WHERE id = 2;
---error 1501
+--error 1508
 SELECT * FROM t1 PARTITION (foo);
 
 # now try indexes
@@ -50,7 +50,7 @@
 SELECT * FROM t2 PARTITION (p3);
 SELECT * FROM t2 PARTITION (p3) ORDER BY id;
 SELECT * FROM t2 PARTITION (p3) WHERE id = 2;
---error 1501
+--error 1508
 SELECT * FROM t2 PARTITION (foo);
 
 
Thread
bk commit into 5.1 tree (patg:1.2025)Patrick Galbraith18 Jan