summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <istruewing@chilla.local>2007-03-14 16:27:37 +0100
committerunknown <istruewing@chilla.local>2007-03-14 16:27:37 +0100
commit3c89dd7966e727d7ded902b195d8f133de94b565 (patch)
treece0a8f2a1c57e4bb307809bce32ade81d8fb12a1
parentda9c659c8196d1da63330fc7b1b6710217801a6f (diff)
downloadmariadb-git-3c89dd7966e727d7ded902b195d8f133de94b565.tar.gz
Bug#25289 - repair table causes "my_seek.c:56:
my_seek: Assertion `fd != -1' failed" In difficult optimize/repair situations the server could crash. Under some circumstances the server retries an optimize/repair with more elaborate options. But it did not check if the first attempt failed so badly that a second one must not be tried. This could happen when a new data file has been created but it was not possible to open it. In this case the repair leaves behind a table with closed data file. This must not be used for another repair attempt. We do now detect the closed data file and do not try another repair attempt in this situation. No test case. The required table corruption can not be repeated easily. There is a test program attached to bug 25433. sql/ha_myisam.cc: Bug#25289 - repair table causes "my_seek.c:56: my_seek: Assertion `fd != -1' failed" Added code to detect a closed data file. It could be closed by a preceeding repair attempt. We must not try another repair then.
-rw-r--r--sql/ha_myisam.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc
index 2cec03a51db..42be008de9e 100644
--- a/sql/ha_myisam.cc
+++ b/sql/ha_myisam.cc
@@ -867,6 +867,22 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
ha_rows rows= file->state->records;
DBUG_ENTER("ha_myisam::repair");
+ /*
+ Normally this method is entered with a properly opened table. If the
+ repair fails, it can be repeated with more elaborate options. Under
+ special circumstances it can happen that a repair fails so that it
+ closed the data file and cannot re-open it. In this case file->dfile
+ is set to -1. We must not try another repair without an open data
+ file. (Bug #25289)
+ */
+ if (file->dfile == -1)
+ {
+ sql_print_information("Retrying repair of: '%s' failed. "
+ "Please try REPAIR EXTENDED or myisamchk",
+ table->path);
+ DBUG_RETURN(HA_ADMIN_FAILED);
+ }
+
param.db_name = table->table_cache_key;
param.table_name = table->table_name;
param.tmpfile_createflag = O_RDWR | O_TRUNC;