List:Commits« Previous MessageNext Message »
From:Patrick Galbraith Date:January 18 2006 12:36am
Subject:bk commit into 5.1 tree (patg:1.2021)
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.2021 06/01/17 16:36:25 patg@stripped +5 -0
  WL# 2682
  
  Various review fixes per Mikael. Still have issues getting locking working.

  sql/sql_partition.cc
    1.20 06/01/17 16:36:21 patg@stripped +6 -6
    WL# 2682
    
    Modified set_specific_partition to accept a particular MY_BITMAP as opposed
    to the default used_partitions

  sql/handler.h
    1.179 06/01/17 16:36:21 patg@stripped +1 -1
    WL# 2682
    
    Modified set_specific_partition to accept a particular MY_BITMAP, in the case
    we want to set the used_partitions_copy bitmap

  sql/ha_partition.h
    1.13 06/01/17 16:36:21 patg@stripped +1 -1
    WL# 2682
    
    In order to be able to set m_lock_count to 0 and increment in do {} while loop
    removed 'const' declaration of lock_count

  sql/ha_partition.cc
    1.30 06/01/17 16:36:21 patg@stripped +45 -7
    WL #2682, review changes per Mikael
    
    * Added used_partitions_copy, a backup of used_partitions to use in making sure
    whatever partitions we lock, we unlock the exact same paritions.
    
    * Modified set_specific_partition to be able to be passed a _particular_ 
    MY_BITMAP
    
    * Added do {} while loop to lock_count() to count m_no_locks to match the number
    of partitions locked.  

  mysys/my_bitmap.c
    1.38 06/01/17 16:36:21 patg@stripped +4 -2
    WL #2682
    
    Fixes to bitmap_copy

# 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.178/sql/handler.h	2006-01-16 16:50:32 -08:00
+++ 1.179/sql/handler.h	2006-01-17 16:36:21 -08:00
@@ -810,7 +810,7 @@
                                            bool include_endpoint);
 
 int populate_partition_name_hash(partition_info *m_part_info);
-int set_specific_partition(partition_info *m_part_info,
+int set_specific_partition(MY_BITMAP *bitmap, partition_info *m_part_info,
                                          const char *partition_name);
 int get_partition_index(partition_info *m_part_info,
                         const char* partition_name);

--- 1.37/mysys/my_bitmap.c	2006-01-16 16:50:32 -08:00
+++ 1.38/mysys/my_bitmap.c	2006-01-17 16:36:21 -08:00
@@ -306,9 +306,11 @@
 
 void bitmap_copy(MY_BITMAP *to, const MY_BITMAP *from)
 {
-  DBUG_ASSERT(sizeof(to) ==  sizeof(from));
+  DBUG_ASSERT(no_words_in_map(to) ==  no_words_in_map(from));
   DBUG_ENTER("bitmap_copy");
-  memcpy(to, from, sizeof(MY_BITMAP));
+  DBUG_PRINT("info", ("before to %lx from %lx", *to->bitmap, *from->bitmap));
+  memcpy(to->bitmap, from->bitmap, no_words_in_map(from));
+  DBUG_PRINT("info", ("after to %lx from %lx", *to->bitmap, *from->bitmap));
   DBUG_VOID_RETURN;
 }
 

--- 1.29/sql/ha_partition.cc	2006-01-16 16:50:32 -08:00
+++ 1.30/sql/ha_partition.cc	2006-01-17 16:36:21 -08:00
@@ -912,7 +912,9 @@
 
   /* 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))
@@ -1027,11 +1029,17 @@
 {
   uint error;
   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)
   {
-    if ((error= set_specific_partition(m_part_info, table->partition_name)))
+    if ((error= set_specific_partition(&(m_part_info->used_partitions),
+                                       m_part_info,
+                                       table->partition_name)))
     {
       DBUG_RETURN(error);
     }
@@ -1040,11 +1048,13 @@
   {
     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;
   do
   {
-    if (_bitmap_is_set(&(m_part_info->used_partitions), (file - m_file)))
+    if (_bitmap_is_set(&(m_part_info->used_partitions_copy), (file - m_file)))
     {
       if ((error= (*file)->external_lock(thd, lock_type)))
       {
@@ -1059,7 +1069,7 @@
 err_handler:
   while (file-- != m_file)
   {
-    if (_bitmap_is_set(&(m_part_info->used_partitions), (file - m_file)))
+    if (_bitmap_is_set(&(m_part_info->used_partitions_copy), (file - m_file)))
     {
       (*file)->external_lock(thd, F_UNLCK);
     }
@@ -1107,10 +1117,15 @@
 {
   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
   {
-    to= (*file)->store_lock(thd, to, lock_type);
+    if (_bitmap_is_set(&(m_part_info->used_partitions_copy), (file - m_file)))
+      to= (*file)->store_lock(thd, to, lock_type);
   } while (*(++file));
   DBUG_RETURN(to);
 }
@@ -1120,11 +1135,17 @@
   int i= 0;
   int error= 0;
   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)
   {
-    if ((error= set_specific_partition(m_part_info, table->partition_name)))
+    if ((error= set_specific_partition(&(m_part_info->used_partitions),
+                                       m_part_info,
+                                       table->partition_name)))
     {
       DBUG_RETURN(error);
     }
@@ -1133,12 +1154,14 @@
   {
     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;
   do
   {
-    if (_bitmap_is_set(&(m_part_info->used_partitions), (file - m_file)))
+    if (_bitmap_is_set(&(m_part_info->used_partitions_copy), (file - m_file)))
     {
       if ((error= (*file)->start_stmt(thd, lock_type)))
         break;
@@ -1155,9 +1178,24 @@
   sufficient space for lock structures.
 */
 
-uint ha_partition::lock_count() const
+uint ha_partition::lock_count()
 {
+  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);
 }
 

--- 1.12/sql/ha_partition.h	2006-01-16 16:50:32 -08:00
+++ 1.13/sql/ha_partition.h	2006-01-17 16:36:21 -08:00
@@ -249,7 +249,7 @@
   /*
     Lock count is number of locked underlying handlers (I assume)
   */
-  virtual uint lock_count(void) const;
+  virtual uint lock_count(void);
   /*
     Call to unlock rows not to be updated in transaction
   */

--- 1.19/sql/sql_partition.cc	2006-01-16 16:50:32 -08:00
+++ 1.20/sql/sql_partition.cc	2006-01-17 16:36:21 -08:00
@@ -192,14 +192,14 @@
     error code if error
     0 if no partition exists
 */
-int set_specific_partition(partition_info *m_part_info,
+int set_specific_partition(MY_BITMAP *bitmap, partition_info *m_part_info,
                                          const char *partition_name)
 {
   int error;
   DBUG_ENTER("set_specific_partition");
   partition_element *el= (partition_element*)hash_search(
-	                                 &(m_part_info->partition_names), 
-	                                 (byte*)partition_name, 
+	                                 &(m_part_info->partition_names),
+	                                 (byte*)partition_name,
 									                  strlen(partition_name));
   if (el == NULL)
   {
@@ -208,7 +208,7 @@
   }
 
   DBUG_PRINT("info", ("selected partition %s is in table", partition_name));
-  bitmap_clear_all(&m_part_info->used_partitions);
+  bitmap_clear_all(bitmap);
 
   if (is_sub_partitioned(m_part_info) && (el->subpartitions.elements > 0))
   {
@@ -216,11 +216,11 @@
     partition_element *sub_el;
     while ((sub_el= sub_part_it++) != NULL)
     {
-      bitmap_set_bit(&(m_part_info->used_partitions), sub_el->index);
+      bitmap_set_bit(bitmap, sub_el->index);
     }
   }
   else
-    bitmap_set_bit(&(m_part_info->used_partitions), el->index);
+    bitmap_set_bit(bitmap, el->index);
 
   DBUG_RETURN(0);
 }
Thread
bk commit into 5.1 tree (patg:1.2021)Patrick Galbraith18 Jan