← Back to team overview

maria-developers team mailing list archive

[Branch ~maria-captains/maria/5.1] Rev 2742: Merge with bug fix

 

Merge authors:
  Michael Widenius (monty)
------------------------------------------------------------
revno: 2742 [merge]
committer: Michael Widenius <monty@xxxxxxxxxxxx>
branch nick: maria-skr
timestamp: Tue 2009-10-06 09:20:31 +0300
message:
  Merge with bug fix
modified:
  storage/maria/ma_extra.c
  storage/maria/ma_locking.c
  storage/myisam/mi_extra.c


--
lp:maria
https://code.launchpad.net/~maria-captains/maria/5.1

Your team Maria developers is subscribed to branch lp:maria.
To unsubscribe from this branch go to https://code.launchpad.net/~maria-captains/maria/5.1/+edit-subscription.
=== modified file 'storage/maria/ma_extra.c'
--- storage/maria/ma_extra.c	2009-02-19 09:01:25 +0000
+++ storage/maria/ma_extra.c	2009-10-06 06:13:56 +0000
@@ -323,9 +323,16 @@
         error= my_errno;
       info->lock_type= F_UNLCK;
     }
-    if (share->kfile.file >= 0)
+    /*
+      We don't need to call _mi_decrement_open_count() if we are
+      dropping the table, as the files will be removed anyway. If we
+      are aborted before the files is removed, it's better to not
+      call it as in that case the automatic repair on open will add
+      the missing index entries
+    */
+    pthread_mutex_lock(&share->intern_lock);
+    if (share->kfile.file >= 0 && function != HA_EXTRA_PREPARE_FOR_DROP)
       _ma_decrement_open_count(info);
-    pthread_mutex_lock(&share->intern_lock);
     if (info->trn)
     {
       _ma_remove_table_from_trnman(share, info->trn);

=== modified file 'storage/maria/ma_locking.c'
--- storage/maria/ma_locking.c	2009-02-09 21:52:42 +0000
+++ storage/maria/ma_locking.c	2009-10-06 06:13:56 +0000
@@ -484,7 +484,7 @@
   {
     uint old_lock=info->lock_type;
     share->global_changed=0;
-    lock_error=maria_lock_database(info,F_WRLCK);
+    lock_error= my_disable_locking ? 0 : maria_lock_database(info, F_WRLCK);
     /* Its not fatal even if we couldn't get the lock ! */
     if (share->state.open_count > 0)
     {
@@ -499,7 +499,7 @@
                                      MYF(MY_NABP));
       }
     }
-    if (!lock_error)
+    if (!lock_error && !my_disable_locking)
       lock_error=maria_lock_database(info,old_lock);
   }
   return test(lock_error || write_error);

=== modified file 'storage/myisam/mi_extra.c'
--- storage/myisam/mi_extra.c	2009-09-03 14:05:38 +0000
+++ storage/myisam/mi_extra.c	2009-10-06 06:13:56 +0000
@@ -286,9 +286,19 @@
       info->lock_type = F_UNLCK;
     }
     if (share->kfile >= 0)
+    {
+      /*
+        We don't need to call _mi_decrement_open_count() if we are
+        dropping the table, as the files will be removed anyway. If we
+        are aborted before the files is removed, it's better to not
+        call it as in that case the automatic repair on open will add
+        the missing index entries
+      */
+      if (function != HA_EXTRA_PREPARE_FOR_DROP)
       _mi_decrement_open_count(info);
-    if (share->kfile >= 0 && my_close(share->kfile,MYF(0)))
-      error=my_errno;
+      if (my_close(share->kfile,MYF(0)))
+        error=my_errno;
+    }
     {
       LIST *list_element ;
       for (list_element=myisam_open_list ;