summaryrefslogtreecommitdiff
path: root/storage/archive
diff options
context:
space:
mode:
authorAshish Agarwal <ashish.y.agarwal@oracle.com>2012-02-03 19:41:03 +0530
committerAshish Agarwal <ashish.y.agarwal@oracle.com>2012-02-03 19:41:03 +0530
commitb2596464603f7d4b472af0aaaff223e91f105bb4 (patch)
tree679ae221434b074725a67c336a701a6b4fe6dee3 /storage/archive
parent0a17a3507186dffd5bb4054a9e0bc82769d2f354 (diff)
parentcfcb5daba80df535527890b5bd37607057623e8f (diff)
downloadmariadb-git-b2596464603f7d4b472af0aaaff223e91f105bb4.tar.gz
BUG#11748748: Merge from mysql-5.1 to mysql-5.5
Diffstat (limited to 'storage/archive')
-rw-r--r--storage/archive/ha_archive.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc
index 7b943139c24..332afb4d437 100644
--- a/storage/archive/ha_archive.cc
+++ b/storage/archive/ha_archive.cc
@@ -1394,6 +1394,7 @@ int ha_archive::optimize(THD* thd, HA_CHECK_OPT* check_opt)
char writer_filename[FN_REFLEN];
DBUG_ENTER("ha_archive::optimize");
+ mysql_mutex_lock(&share->mutex);
init_archive_reader();
// now we close both our writer and our reader for the rename
@@ -1408,7 +1409,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)))
+ {
+ mysql_mutex_unlock(&share->mutex);
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
+ }
/*
Transfer the embedded FRM so that the file can be discoverable.
@@ -1494,10 +1498,12 @@ int ha_archive::optimize(THD* thd, HA_CHECK_OPT* check_opt)
rc= my_rename(writer_filename, share->data_file_name, MYF(0));
+ mysql_mutex_unlock(&share->mutex);
DBUG_RETURN(rc);
error:
DBUG_PRINT("ha_archive", ("Failed to recover, error was %d", rc));
azclose(&writer);
+ mysql_mutex_unlock(&share->mutex);
DBUG_RETURN(rc);
}