summaryrefslogtreecommitdiff
path: root/sql/ha_myisam.cc
diff options
context:
space:
mode:
authorunknown <serg@serg.mysql.com>2002-11-13 22:55:32 +0100
committerunknown <serg@serg.mysql.com>2002-11-13 22:55:32 +0100
commitffb4dee5a5297cdd7fa27aa87a8f505fbb88515b (patch)
treea72d940fcd9d0360195e53da561dc698269b1ad2 /sql/ha_myisam.cc
parent6580fbaf6f7d7b894a3e5feb1fdef3934bb82462 (diff)
downloadmariadb-git-ffb4dee5a5297cdd7fa27aa87a8f505fbb88515b.tar.gz
optimize table corruption fixed, though more clean fix is desired.
Fix for another optimize bug is undone, as the new one handles both cases. test added mysql-test/r/myisam.result: updated mysql-test/t/myisam.test: optimize table corruption test sql/ha_myisam.cc: optimize table corruption fixed, though more clean fix is desired. Fix for another optimize bug is undone, as the new one handles both cases.
Diffstat (limited to 'sql/ha_myisam.cc')
-rw-r--r--sql/ha_myisam.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc
index c14ca7d034e..f96781f83b4 100644
--- a/sql/ha_myisam.cc
+++ b/sql/ha_myisam.cc
@@ -561,7 +561,6 @@ 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))))
@@ -618,7 +617,16 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
STATE_CRASHED_ON_REPAIR);
file->update|=HA_STATE_CHANGED | HA_STATE_ROW_CHANGED;
}
- file->save_state=file->s->state.state;
+ /* Here we need to make file->save_state and file->s->state.state
+ equal. Unfortunately, sometime table comes locked here (so
+ file->save_state represents actual table state), and sometime
+ unlocked (and actual is file->s->state.state instead). This all
+ is very confusing, and should be streamlined (TODO).
+ */
+ if (file->state == & file->save_state)
+ file->s->state.state=file->save_state;
+ else
+ file->save_state=file->s->state.state;
if (file->s->base.auto_key)
update_auto_increment_key(&param, file, 1);
if (optimize_done)