summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-06-13 15:13:13 +0200
committerSergei Golubchik <sergii@pisem.net>2013-06-13 15:13:13 +0200
commit3ddfab5e3c99a5f943cec1f003dbee5a2478c853 (patch)
tree573e22e01fee21b29813fe62929dd8d9358c2864
parent5dee28b1c8f8239699191fbf205b4e8184c57535 (diff)
downloadmariadb-git-3ddfab5e3c99a5f943cec1f003dbee5a2478c853.tar.gz
MDEV-4444 Server crashes with "safe_mutex: Trying to destroy a mutex share->mutex that was locked" on attempt to recover an archive table
-rw-r--r--mysql-test/suite/archive/repair.result11
-rw-r--r--mysql-test/suite/archive/repair.test18
-rw-r--r--storage/archive/ha_archive.cc3
3 files changed, 32 insertions, 0 deletions
diff --git a/mysql-test/suite/archive/repair.result b/mysql-test/suite/archive/repair.result
new file mode 100644
index 00000000000..5a8c92189d6
--- /dev/null
+++ b/mysql-test/suite/archive/repair.result
@@ -0,0 +1,11 @@
+create table t1 (a int) engine=archive;
+insert into t1 values (1);
+select * from t1;
+Got one of the listed errors
+insert into t1 values (2);
+ERROR HY000: Table 't1' is marked as crashed and should be repaired
+repair table t1;
+Table Op Msg_type Msg_text
+test.t1 repair error Corrupt
+drop table t1;
+ERROR 42S02: Unknown table 't1'
diff --git a/mysql-test/suite/archive/repair.test b/mysql-test/suite/archive/repair.test
new file mode 100644
index 00000000000..71f55c923b5
--- /dev/null
+++ b/mysql-test/suite/archive/repair.test
@@ -0,0 +1,18 @@
+#
+# MDEV-4444 Server crashes with "safe_mutex: Trying to destroy a mutex share->mutex that was locked" on attempt to recover an archive table
+#
+
+--source include/have_archive.inc
+
+--let $datadir = `SELECT @@datadir`
+
+create table t1 (a int) engine=archive;
+insert into t1 values (1);
+--remove_file $datadir/test/t1.ARZ
+--error 13,1017
+select * from t1;
+--error ER_CRASHED_ON_USAGE
+insert into t1 values (2);
+repair table t1;
+--error ER_BAD_TABLE_ERROR
+drop table t1;
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc
index f5b96989811..e33b1735914 100644
--- a/storage/archive/ha_archive.cc
+++ b/storage/archive/ha_archive.cc
@@ -1417,7 +1417,10 @@ int ha_archive::optimize(THD* thd, HA_CHECK_OPT* check_opt)
mysql_mutex_lock(&share->mutex);
if (init_archive_reader())
+ {
+ mysql_mutex_unlock(&share->mutex);
DBUG_RETURN(errno);
+ }
// now we close both our writer and our reader for the rename
if (share->archive_write_open)