Commit ffee15b1 authored by Michael Widenius's avatar Michael Widenius

Merge with bug fix

parents 76d47f53 0e9e201d
......@@ -323,9 +323,16 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function,
error= my_errno;
info->lock_type= F_UNLCK;
}
if (share->kfile.file >= 0)
_ma_decrement_open_count(info);
/*
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);
if (info->trn)
{
_ma_remove_table_from_trnman(share, info->trn);
......
......@@ -484,7 +484,7 @@ int _ma_decrement_open_count(MARIA_HA *info)
{
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 @@ int _ma_decrement_open_count(MARIA_HA *info)
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);
......
......@@ -286,9 +286,19 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
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)))
if (my_close(share->kfile,MYF(0)))
error=my_errno;
}
{
LIST *list_element ;
for (list_element=myisam_open_list ;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment