summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@donna.mysql.com>2000-11-21 03:43:34 +0200
committerunknown <monty@donna.mysql.com>2000-11-21 03:43:34 +0200
commit7c881e34ef78cd541cb98738215c8f062024dbad (patch)
tree18fdf025bea7d918e304f45384902d822f68f2f6 /sql
parent675d1803db1ea6da10dda7ac05ec7800bf6a0d31 (diff)
downloadmariadb-git-7c881e34ef78cd541cb98738215c8f062024dbad.tar.gz
Fixed problem with auto-repair of MyISAM tables
Fixed bug in ISAM and MyISAM when updating from multiple-processes Docs/manual.texi: Updated changelog client/mysqladmin.c: Upgraded version number because the change of llstr() is visible extra/perror.c: Added new error message include/my_base.h: Added HA_ERR_CRASHED_ON_USAGE isam/rnext.c: Fixed bug when updating from multiple-processes isam/rprev.c: Fixed bug when updating from multiple-processes libmysql/libmysql.c: Fixed that mysql->options.client_flag was used properly myisam/mi_locking.c: Fixed bug when updating from multiple-processes myisam/mi_open.c: Fixed bug when updating from multiple-processes Added HA_ERR_CRASHED_ON_USAGE myisam/mi_rnext.c: Fixed bug when updating from multiple-processes myisam/mi_rprev.c: Fixed bug when updating from multiple-processes myisam/myisamchk.c: Added HA_ERR_CRASHED_ON_USAGE sql/sql_base.cc: Fixed problem with auto-repair of MyISAM tables sql/table.cc: Fixed problem with auto-repair of MyISAM tables
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_base.cc11
-rw-r--r--sql/table.cc3
2 files changed, 8 insertions, 6 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 4a5f5e582f3..3560fc42d49 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -1162,25 +1162,26 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db,
HA_TRY_READ_ONLY),
READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD,
ha_open_options | HA_OPEN_FOR_REPAIR,
- entry) ||
+ entry) || ! entry->file ||
(entry->file->is_crashed() && entry->file->check_and_repair(thd)))
{
/* Give right error message */
thd->net.last_error[0]=0;
thd->net.last_errno=0;
- entry->file->print_error(HA_ERR_CRASHED,MYF(0));
+ my_error(ER_NOT_KEYFILE, MYF(0), name, my_errno);
sql_print_error("Error: Couldn't repair table: %s.%s",db,name);
- closefrm(entry);
+ if (entry->file)
+ closefrm(entry);
error=1;
}
else
{
- thd->net.last_error[0]=0; // Clear error message
+ thd->net.last_error[0]=0; // Clear error message
thd->net.last_errno=0;
}
- unlock_table_name(thd,&table_list);
if (locked)
pthread_mutex_lock(&LOCK_open); // Get back original lock
+ unlock_table_name(thd,&table_list);
if (error)
goto err;
}
diff --git a/sql/table.cc b/sql/table.cc
index bdc2c0f124e..c840b36da05 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -542,7 +542,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
HA_OPEN_IGNORE_IF_LOCKED) | ha_open_flags))))
{
/* Set a flag if the table is crashed and it can be auto. repaired */
- outparam->crashed=(err == HA_ERR_CRASHED &&
+ outparam->crashed=(err == HA_ERR_CRASHED_ON_USAGE &&
outparam->file->auto_repair() &&
!(ha_open_flags & HA_OPEN_FOR_REPAIR));
goto err_not_open; /* purecov: inspected */
@@ -569,6 +569,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
frm_error(error,outparam,name,ME_ERROR+ME_WAITTANG);
delete outparam->file;
outparam->file=0; // For easyer errorchecking
+ outparam->db_stat=0;
free_root(&outparam->mem_root,MYF(0));
my_free(outparam->table_name,MYF(MY_ALLOW_ZERO_PTR));
DBUG_RETURN (error);