summaryrefslogtreecommitdiff
path: root/storage/myisam
diff options
context:
space:
mode:
Diffstat (limited to 'storage/myisam')
-rw-r--r--storage/myisam/mi_close.c17
-rw-r--r--storage/myisam/mi_extra.c4
2 files changed, 12 insertions, 9 deletions
diff --git a/storage/myisam/mi_close.c b/storage/myisam/mi_close.c
index ad1d3074a27..5f2154534ae 100644
--- a/storage/myisam/mi_close.c
+++ b/storage/myisam/mi_close.c
@@ -65,11 +65,8 @@ int mi_close(register MI_INFO *info)
DBUG_EXECUTE_IF("crash_before_flush_keys",
if (share->kfile >= 0) DBUG_ABORT(););
if (share->kfile >= 0 &&
- flush_key_blocks(share->key_cache, share->kfile,
- &share->dirty_part_map,
- ((share->temporary || share->deleting) ?
- FLUSH_IGNORE_CHANGED :
- FLUSH_RELEASE)))
+ flush_key_blocks(share->key_cache, share->kfile, &share->dirty_part_map,
+ share->deleting ? FLUSH_IGNORE_CHANGED : FLUSH_RELEASE))
error=my_errno;
if (share->kfile >= 0)
{
@@ -77,10 +74,14 @@ int mi_close(register MI_INFO *info)
If we are crashed, we can safely flush the current state as it will
not change the crashed state.
We can NOT write the state in other cases as other threads
- may be using the file at this point
- IF using --external-locking.
+ may be using the file at this point IF using --external-locking.
+
+ Also, write the state if a temporary table is not being dropped
+ (the server might want to reopen it, and mi_lock_database() only
+ writes the state for non-temp ones)
*/
- if (share->mode != O_RDONLY && mi_is_crashed(info))
+ if (share->mode != O_RDONLY &&
+ (mi_is_crashed(info) || (share->temporary && !share->deleting)))
mi_state_info_write(share->kfile, &share->state, 1);
/* Decrement open count must be last I/O on this file. */
_mi_decrement_open_count(info);
diff --git a/storage/myisam/mi_extra.c b/storage/myisam/mi_extra.c
index 39b28d95759..dcb79a8dc3e 100644
--- a/storage/myisam/mi_extra.c
+++ b/storage/myisam/mi_extra.c
@@ -260,9 +260,11 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
break;
case HA_EXTRA_PREPARE_FOR_DROP:
/* Signals about intent to delete this table */
- //share->deleting= TRUE;
+ share->deleting= TRUE;
share->global_changed= FALSE; /* force writing changed flag */
_mi_mark_file_changed(info);
+ if (share->temporary)
+ break;
/* fall through */
case HA_EXTRA_PREPARE_FOR_RENAME:
DBUG_ASSERT(!share->temporary);