diff options
Diffstat (limited to 'storage/archive/ha_archive.cc')
-rw-r--r-- | storage/archive/ha_archive.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index 618fc1ea7f3..ea778cd23a8 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2004, 2011, Oracle and/or its affiliates + Copyright (c) 2004, 2012, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -1319,6 +1319,7 @@ int ha_archive::optimize(THD* thd, HA_CHECK_OPT* check_opt) azio_stream writer; char writer_filename[FN_REFLEN]; + pthread_mutex_lock(&share->mutex); init_archive_reader(); // now we close both our writer and our reader for the rename @@ -1333,7 +1334,10 @@ int ha_archive::optimize(THD* thd, HA_CHECK_OPT* check_opt) MY_REPLACE_EXT | MY_UNPACK_FILENAME); if (!(azopen(&writer, writer_filename, O_CREAT|O_RDWR|O_BINARY))) + { + pthread_mutex_unlock(&share->mutex); DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); + } /* An extended rebuild is a lot more effort. We open up each row and re-record it. @@ -1412,10 +1416,12 @@ int ha_archive::optimize(THD* thd, HA_CHECK_OPT* check_opt) rc = my_rename(writer_filename,share->data_file_name,MYF(0)); + pthread_mutex_unlock(&share->mutex); DBUG_RETURN(rc); error: DBUG_PRINT("ha_archive", ("Failed to recover, error was %d", rc)); azclose(&writer); + pthread_mutex_unlock(&share->mutex); DBUG_RETURN(rc); } |