summaryrefslogtreecommitdiff
path: root/myisam/mi_locking.c
diff options
context:
space:
mode:
Diffstat (limited to 'myisam/mi_locking.c')
-rw-r--r--myisam/mi_locking.c37
1 files changed, 22 insertions, 15 deletions
diff --git a/myisam/mi_locking.c b/myisam/mi_locking.c
index 22772a3dd2e..a707eb294a9 100644
--- a/myisam/mi_locking.c
+++ b/myisam/mi_locking.c
@@ -35,6 +35,7 @@ int mi_lock_database(MI_INFO *info, int lock_type)
MYISAM_SHARE *share=info->s;
uint flag;
DBUG_ENTER("mi_lock_database");
+ DBUG_PRINT("info",("lock_type: %d", lock_type));
if (share->options & HA_OPTION_READ_ONLY_DATA ||
info->lock_type == lock_type)
@@ -53,6 +54,7 @@ int mi_lock_database(MI_INFO *info, int lock_type)
{
switch (lock_type) {
case F_UNLCK:
+ DBUG_PRINT("info", ("old lock: %d", info->lock_type));
if (info->lock_type == F_RDLCK)
count= --share->r_locks;
else
@@ -74,6 +76,8 @@ int mi_lock_database(MI_INFO *info, int lock_type)
}
if (!count)
{
+ DBUG_PRINT("info",("changed: %u w_locks: %u",
+ (uint) share->changed, share->w_locks));
if (share->changed && !share->w_locks)
{
share->state.process= share->last_process=share->this_process;
@@ -106,19 +110,22 @@ int mi_lock_database(MI_INFO *info, int lock_type)
if (error)
mi_mark_crashed(info);
}
- if (share->r_locks)
- { /* Only read locks left */
- flag=1;
- if (my_lock(share->kfile,F_RDLCK,0L,F_TO_EOF,
- MYF(MY_WME | MY_SEEK_NOT_DONE)) && !error)
- error=my_errno;
- }
- else if (!share->w_locks)
- { /* No more locks */
- flag=1;
- if (my_lock(share->kfile,F_UNLCK,0L,F_TO_EOF,
- MYF(MY_WME | MY_SEEK_NOT_DONE)) && !error)
- error=my_errno;
+ if (info->lock_type != F_EXTRA_LCK)
+ {
+ if (share->r_locks)
+ { /* Only read locks left */
+ flag=1;
+ if (my_lock(share->kfile,F_RDLCK,0L,F_TO_EOF,
+ MYF(MY_WME | MY_SEEK_NOT_DONE)) && !error)
+ error=my_errno;
+ }
+ else if (!share->w_locks)
+ { /* No more locks */
+ flag=1;
+ if (my_lock(share->kfile,F_UNLCK,0L,F_TO_EOF,
+ MYF(MY_WME | MY_SEEK_NOT_DONE)) && !error)
+ error=my_errno;
+ }
}
}
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
@@ -347,6 +354,8 @@ int _mi_writeinfo(register MI_INFO *info, uint operation)
int error,olderror;
MYISAM_SHARE *share=info->s;
DBUG_ENTER("_mi_writeinfo");
+ DBUG_PRINT("info",("operation: %u tot_locks: %u", operation,
+ share->tot_locks));
error=0;
if (share->tot_locks == 0)
@@ -374,9 +383,7 @@ int _mi_writeinfo(register MI_INFO *info, uint operation)
my_errno=olderror;
}
else if (operation)
- {
share->changed= 1; /* Mark keyfile changed */
- }
DBUG_RETURN(error);
} /* _mi_writeinfo */