summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <serg@serg.mysql.com>2002-08-31 23:18:08 +0000
committerunknown <serg@serg.mysql.com>2002-08-31 23:18:08 +0000
commit9418a8805716ef10ed7e39f2e56c44a9ade55bb4 (patch)
tree3732ba6a0c00f9e269510a87e8bbedf1a98a1642
parent3bf098bf548b2af3ae61b7bfca9d3a0cde952544 (diff)
downloadmariadb-git-9418a8805716ef10ed7e39f2e56c44a9ade55bb4.tar.gz
LOCK+modify+OPTIMIZE bugfix
-rw-r--r--Docs/manual.texi3
-rw-r--r--mysql-test/r/myisam.result2
-rw-r--r--mysql-test/t/myisam.test11
-rw-r--r--sql/ha_myisam.cc1
4 files changed, 17 insertions, 0 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi
index 87b9a480f3f..ffefdc28409 100644
--- a/Docs/manual.texi
+++ b/Docs/manual.texi
@@ -46929,6 +46929,9 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.53
@itemize @bullet
@item
+Fixed a bug that @code{OPTIMIZE} of locked and modified MyISAM table,
+reported table corruption.
+@item
Fixed a @code{BDB}-related @code{ALTER TABLE} bug with dropping a column
and shutting down immediately thereafter.
@item
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
index a8f97c57d33..f57b99cf9fd 100644
--- a/mysql-test/r/myisam.result
+++ b/mysql-test/r/myisam.result
@@ -36,3 +36,5 @@ table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 4
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 4
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index eb1d9a01020..45d26993795 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -64,3 +64,14 @@ explain select a,b from t1 order by b;
explain select a,b from t1;
explain select a,b,c from t1;
drop table t1;
+
+#
+# Test of OPTIMIZE of locked and modified tables
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1), (2), (3);
+LOCK TABLES t1 WRITE;
+INSERT INTO t1 VALUES (1), (2), (3);
+OPTIMIZE TABLE t1;
+DROP TABLE t1;
+
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc
index 595c83ff8ef..c14ca7d034e 100644
--- a/sql/ha_myisam.cc
+++ b/sql/ha_myisam.cc
@@ -561,6 +561,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
}
if (!optimize ||
+ memcmp(file->state, & share->state.state, sizeof(MI_STATUS_INFO)) ||
((file->state->del || share->state.split != file->state->records) &&
(!param.opt_rep_quick ||
!(share->state.changed & STATE_NOT_OPTIMIZED_KEYS))))