diff options
Diffstat (limited to 'storage/maria/ma_locking.c')
-rw-r--r-- | storage/maria/ma_locking.c | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/storage/maria/ma_locking.c b/storage/maria/ma_locking.c index 6bb308e5959..dc1189619ed 100644 --- a/storage/maria/ma_locking.c +++ b/storage/maria/ma_locking.c @@ -80,9 +80,8 @@ int maria_lock_database(MARIA_HA *info, int lock_type) { if (end_io_cache(&info->rec_cache)) { - error=my_errno; - maria_print_error(info->s, HA_ERR_CRASHED); - maria_mark_crashed(info); + error= my_errno; + _ma_set_fatal_error(share, error); } } if (!count) @@ -129,10 +128,7 @@ int maria_lock_database(MARIA_HA *info, int lock_type) else share->not_flushed=1; if (error) - { - maria_print_error(info->s, HA_ERR_CRASHED); - maria_mark_crashed(info); - } + _ma_set_fatal_error(share, error); } } info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED); @@ -528,6 +524,28 @@ void _ma_mark_file_crashed(MARIA_SHARE *share) DBUG_VOID_RETURN; } +/* + Handle a fatal error + + - Mark the table as crashed + - Print an error message, if we had not issued an error message before + that the table had been crashed. + - set my_errno to error + - If 'maria_assert_if_crashed_table is set, then assert. +*/ + +void _ma_set_fatal_error(MARIA_SHARE *share, int error) +{ + maria_mark_crashed_share(share); + if (!(share->state.changed & STATE_CRASHED_PRINTED)) + { + share->state.changed|= STATE_CRASHED_PRINTED; + maria_print_error(share, error); + } + my_errno= error; + DBUG_ASSERT(!maria_assert_if_crashed_table); +} + /** @brief Set uuid of for a Maria file |