1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

Automatic repair of MyISAM tables + small bug fixes

This commit is contained in:
monty@donna.mysql.com
2000-10-17 00:47:15 +03:00
parent 4229796946
commit 117d8b7f64
20 changed files with 221 additions and 106 deletions

View File

@@ -32,6 +32,9 @@
#ifdef HAVE_BERKELEY_DB
#include "ha_berkeley.h"
#endif
#ifdef HAVE_INNOBASE_DB
#include "ha_innobase.h"
#endif
#include <myisampack.h>
#include <errno.h>
@@ -46,7 +49,7 @@ ulong ha_read_count, ha_write_count, ha_delete_count, ha_update_count,
const char *ha_table_type[] = {
"", "DIAB_ISAM","HASH","MISAM","PISAM","RMS_ISAM","HEAP", "ISAM",
"MRG_ISAM","MYISAM", "MRG_MYISAM", "BERKELEY_DB?", "?", "?",NullS
"MRG_ISAM","MYISAM", "MRG_MYISAM", "BDB", "INNOBASE", "?", "?",NullS
};
const char *ha_row_type[] = {
@@ -66,6 +69,10 @@ enum db_type ha_checktype(enum db_type database_type)
case DB_TYPE_BERKELEY_DB:
return(berkeley_skip ? DB_TYPE_MYISAM : database_type);
#endif
#ifdef HAVE_INNOBASE_DB
case DB_TYPE_INNOBASE:
return(innobase_skip ? DB_TYPE_MYISAM : database_type);
#endif
#ifndef NO_HASH
case DB_TYPE_HASH:
#endif
@@ -103,6 +110,10 @@ handler *get_new_handler(TABLE *table, enum db_type db_type)
#ifdef HAVE_BERKELEY_DB
case DB_TYPE_BERKELEY_DB:
return new ha_berkeley(table);
#endif
#ifdef HAVE_INNOBASE_DB
case DB_TYPE_INNOBASE_DB:
return new ha_innobase(table);
#endif
case DB_TYPE_HEAP:
return new ha_heap(table);
@@ -123,6 +134,14 @@ int ha_init()
if ((error=berkeley_init()))
return error;
}
#endif
#ifdef HAVE_INNOBASE_DB
if (!innobase_skip)
{
int error;
if ((error=innobase_init()))
return error;
}
#endif
return 0;
}
@@ -146,6 +165,10 @@ int ha_panic(enum ha_panic_function flag)
#ifdef HAVE_BERKELEY_DB
if (!berkeley_skip)
error|=berkeley_end();
#endif
#ifdef HAVE_INNOBASE_DB
if (!innobase_skip)
error|=innobase_end();
#endif
return error;
} /* ha_panic */
@@ -154,7 +177,7 @@ int ha_panic(enum ha_panic_function flag)
int ha_autocommit_or_rollback(THD *thd, int error)
{
DBUG_ENTER("ha_autocommit_or_rollback");
#ifdef HAVE_BERKELEY_DB
#if defined(HAVE_BERKELEY_DB) || defined(HAVE_INNOBASE_DB)
if ((thd->options & OPTION_AUTO_COMMIT) && !thd->locked_tables)
{
if (!error)
@@ -183,6 +206,17 @@ int ha_commit(THD *thd)
error=1;
}
}
#endif
#ifdef HAVE_INNOBASE_DB
if (thd->transaction.innobase_tid)
{
int error=innobase_commit(thd);
if (error)
{
my_error(ER_ERROR_DURING_COMMIT, MYF(0), error);
error=1;
}
}
#endif
DBUG_RETURN(error);
}
@@ -201,6 +235,17 @@ int ha_rollback(THD *thd)
error=1;
}
}
#endif
#ifdef HAVE_INNOBASE_DB
if (thd->transaction.innobase_tid)
{
int error=innobase_rollback(thd);
if (error)
{
my_error(ER_ERROR_DURING_ROLLBACK, MYF(0), error);
error=1;
}
}
#endif
DBUG_RETURN(error);
}
@@ -212,6 +257,10 @@ bool ha_flush_logs()
#ifdef HAVE_BERKELEY_DB
if (!berkeley_skip && berkeley_flush_logs())
result=1;
#endif
#ifdef HAVE_INNOBASE_DB
if (!innobase_skip && innobase_flush_logs())
result=1;
#endif
return result;
}