summaryrefslogtreecommitdiff
path: root/storage/myisam
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-05-22 09:20:20 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2017-05-22 09:46:51 +0300
commit70505dd45bd36516206eeeb5dcaa28e5f5a1d6dd (patch)
tree14d0c4dba49e36dc0d80c1ba99757b4074781d2d /storage/myisam
parent7edadde72eb23e9110db8cea810c023104e9d15e (diff)
parent13a350ac29eeb43153c7bca65b73b5dfa9f8ffb5 (diff)
downloadmariadb-git-70505dd45bd36516206eeeb5dcaa28e5f5a1d6dd.tar.gz
Merge 10.1 into 10.2
Diffstat (limited to 'storage/myisam')
-rw-r--r--storage/myisam/mi_extra.c3
-rw-r--r--storage/myisam/mi_locking.c20
2 files changed, 11 insertions, 12 deletions
diff --git a/storage/myisam/mi_extra.c b/storage/myisam/mi_extra.c
index 3d6049c0172..1487592d2d6 100644
--- a/storage/myisam/mi_extra.c
+++ b/storage/myisam/mi_extra.c
@@ -150,6 +150,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
if (info->s->data_file_type != DYNAMIC_RECORD)
break;
/* Remove read/write cache if dynamic rows */
+ /* fall through */
case HA_EXTRA_NO_CACHE:
if (info->opt_flag & (READ_CACHE_USED | WRITE_CACHE_USED))
{
@@ -262,7 +263,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
//share->deleting= TRUE;
share->global_changed= FALSE; /* force writing changed flag */
_mi_mark_file_changed(info);
- /* Fall trough */
+ /* Fall through */
case HA_EXTRA_PREPARE_FOR_RENAME:
DBUG_ASSERT(!share->temporary);
mysql_mutex_lock(&THR_LOCK_myisam);
diff --git a/storage/myisam/mi_locking.c b/storage/myisam/mi_locking.c
index 531b800c63e..1921926463e 100644
--- a/storage/myisam/mi_locking.c
+++ b/storage/myisam/mi_locking.c
@@ -29,7 +29,7 @@ static void mi_update_status_with_lock(MI_INFO *info);
int mi_lock_database(MI_INFO *info, int lock_type)
{
- int error;
+ int error, mark_crashed= 0;
uint count;
MYISAM_SHARE *share=info->s;
DBUG_ENTER("mi_lock_database");
@@ -52,6 +52,7 @@ int mi_lock_database(MI_INFO *info, int lock_type)
}
error= 0;
+ DBUG_EXECUTE_IF ("mi_lock_database_failure", error= EINVAL;);
mysql_mutex_lock(&share->intern_lock);
if (share->kfile >= 0) /* May only be false on windows */
{
@@ -75,17 +76,15 @@ int mi_lock_database(MI_INFO *info, int lock_type)
&share->dirty_part_map,
FLUSH_KEEP))
{
- error=my_errno;
+ mark_crashed= error=my_errno;
mi_print_error(info->s, HA_ERR_CRASHED);
- mi_mark_crashed(info); /* Mark that table must be checked */
}
if (info->opt_flag & (READ_CACHE_USED | WRITE_CACHE_USED))
{
if (end_io_cache(&info->rec_cache))
{
- error=my_errno;
+ mark_crashed= error=my_errno;
mi_print_error(info->s, HA_ERR_CRASHED);
- mi_mark_crashed(info);
}
}
if (!count)
@@ -110,22 +109,19 @@ int mi_lock_database(MI_INFO *info, int lock_type)
share->state.unique= info->last_unique= info->this_unique;
share->state.update_count= info->last_loop= ++info->this_loop;
if (mi_state_info_write(share->kfile, &share->state, 1))
- error=my_errno;
+ mark_crashed= error=my_errno;
share->changed=0;
if (myisam_flush)
{
if (mysql_file_sync(share->kfile, MYF(0)))
- error= my_errno;
+ mark_crashed= error= my_errno;
if (mysql_file_sync(info->dfile, MYF(0)))
- error= my_errno;
+ mark_crashed= error= my_errno;
}
else
share->not_flushed=1;
if (error)
- {
mi_print_error(info->s, HA_ERR_CRASHED);
- mi_mark_crashed(info);
- }
}
if (info->lock_type != F_EXTRA_LCK)
{
@@ -260,6 +256,8 @@ int mi_lock_database(MI_INFO *info, int lock_type)
}
#endif
mysql_mutex_unlock(&share->intern_lock);
+ if (mark_crashed)
+ mi_mark_crashed(info);
DBUG_RETURN(error);
} /* mi_lock_database */