summaryrefslogtreecommitdiff
path: root/sql/table.cc
diff options
context:
space:
mode:
authorunknown <monty@tik.mysql.com>2000-10-11 00:06:37 +0300
committerunknown <monty@tik.mysql.com>2000-10-11 00:06:37 +0300
commitda5366886f2c852cb05f8b9b31848d13a4816cad (patch)
treecf18eb0d045153270d68aec8884a4732e953e883 /sql/table.cc
parentdbde9337c201b7a53357d3904c7f0ac5b046ed85 (diff)
downloadmariadb-git-da5366886f2c852cb05f8b9b31848d13a4816cad.tar.gz
Automatic repair of MyISAM tables + portability fixes
Docs/manual.texi: Changes for 3.23 and change Ansi mode -> ANSI mode include/my_base.h: Automatic repair of MyISAM tables include/myisam.h: Automatic repair of MyISAM tables myisam/ft_update.c: Portability fix myisam/mi_check.c: Automatic repair of MyISAM tables myisam/mi_open.c: Automatic repair of MyISAM tables myisam/myisamchk.c: Allow one to combine check with --old-repair myisam/sort.c: Fix for usage of IO_CACHE mysys/charset.c: Portability fixes mysys/default.c: Added --defaults-extra-dir mysys/mf_tempfile.c: Portability fixes mysys/my_init.c: Remove compiler warning mysys/my_pread.c: Remove compiler warning sql-bench/server-cfg.sh: New benchmark tests sql-bench/test-insert.sh: New benchmark tests sql/ha_myisam.cc: Automatic repair of MyISAM tables sql/ha_myisam.h: Automatic repair of MyISAM tables sql/handler.h: Automatic repair of MyISAM tables sql/lock.cc: Add missing free sql/log_event.cc: Portability fixes sql/sql_base.cc: Automatic repair of MyISAM tables sql/sql_select.h: Remove compiler warning sql/sql_table.cc: Clean up intendent sql/sql_yacc.yy: New syntax for CHECK sql/table.cc: Automatic repair of MyISAM tables sql/table.h: Automatic repair of MyISAM tables BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
Diffstat (limited to 'sql/table.cc')
-rw-r--r--sql/table.cc28
1 files changed, 18 insertions, 10 deletions
diff --git a/sql/table.cc b/sql/table.cc
index c7fe81c182c..c0c4fd1eba2 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -212,17 +212,24 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
error=2;
if (db_stat)
{
- if ((outparam->file->
- ha_open(index_file,
- (db_stat & HA_READ_ONLY ? O_RDONLY : O_RDWR),
- (db_stat & HA_OPEN_TEMPORARY ? HA_OPEN_TMP_TABLE :
- (db_stat & HA_WAIT_IF_LOCKED ||
- specialflag & SPECIAL_WAIT_IF_LOCKED) ?
- HA_OPEN_WAIT_IF_LOCKED :
- (db_stat & (HA_ABORT_IF_LOCKED | HA_GET_INFO)) ?
- HA_OPEN_ABORT_IF_LOCKED :
- HA_OPEN_IGNORE_IF_LOCKED) | ha_open_flags)))
+ int err;
+ if ((err=(outparam->file->
+ ha_open(index_file,
+ (db_stat & HA_READ_ONLY ? O_RDONLY : O_RDWR),
+ (db_stat & HA_OPEN_TEMPORARY ? HA_OPEN_TMP_TABLE :
+ ((db_stat & HA_WAIT_IF_LOCKED) ||
+ (specialflag & SPECIAL_WAIT_IF_LOCKED)) ?
+ HA_OPEN_WAIT_IF_LOCKED :
+ (db_stat & (HA_ABORT_IF_LOCKED | HA_GET_INFO)) ?
+ HA_OPEN_ABORT_IF_LOCKED :
+ 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->file->auto_repair() &&
+ !(ha_open_flags & HA_OPEN_FOR_REPAIR));
goto err_not_open; /* purecov: inspected */
+ }
}
outparam->db_low_byte_first=outparam->file->low_byte_first();
@@ -549,6 +556,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
delete crypted;
my_pthread_setspecific_ptr(THR_MALLOC,old_root);
frm_error(error,outparam,name,ME_ERROR+ME_WAITTANG);
+ delete outparam->file;
outparam->file=0; // For easyer errorchecking
free_root(&outparam->mem_root,MYF(0));
my_free(outparam->table_name,MYF(MY_ALLOW_ZERO_PTR));