From 5655d31d5ff64ecea103be523985fa755586673b Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 2 Oct 2005 19:44:28 -0700 Subject: Next big patch for loadable storage engines! Handlerton array is now created instead of using sys_table_types_st. All storage engines can now have inits and giant ifdef's are now gone for startup. No compeltely clean yet, handlertons will next be merged with sys_table_types. Federated and archive now have real cleanup if their inits fail. sql/examples/ha_archive.cc: Modifications for new ha_init code. The init method now checks for errors and will not start up if the errors occur. sql/examples/ha_archive.h: Change for new init method. sql/examples/ha_example.cc: New handlerton pieces. sql/examples/ha_tina.cc: New handlerton pieces. sql/ha_berkeley.cc: New handlerton pieces, plus changes for ha_init changes. I'm not happy with our current "skip" setup. sql/ha_berkeley.h: Change in init return. sql/ha_blackhole.cc: Changes for new handlerton pieces. sql/ha_federated.cc: Changes for new handlerton and true cleanup code. sql/ha_heap.cc: Changes for new handlerton returns. sql/ha_innodb.cc: Changes for handlerton code. sql/ha_innodb.h: Change in init. sql/ha_myisam.cc: Changes for additional handlerton bits. sql/ha_myisammrg.cc: Changes for new handlerton bits. sql/ha_ndbcluster.cc: Changes for new handlerton bits. sql/ha_ndbcluster.h: Changes for handlerton bits. sql/handler.cc: Changes for ditching show_table_type_st types, and collapsing it into a handlerton array. The ha_init now just loops through all handlers to init (much cleaner...). handlertons and sys_table_types should be merged next. sql/handler.h: Additions for sys_table_types sql/log.cc: Clean up of binlog for changes in handlerton sql/mysql_priv.h: Removed unneeded define for binlog_init sql/sql_show.cc: Changes for change in handlerton to sys_table_types --- sql/ha_berkeley.cc | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'sql/ha_berkeley.cc') diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index 2f47b03de9d..60dd27efa69 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -109,6 +109,10 @@ static int berkeley_rollback(THD *thd, bool all); handlerton berkeley_hton = { "BerkeleyDB", + SHOW_OPTION_YES, + "Supports transactions and page-level locking", + DB_TYPE_BERKELEY_DB, + berkeley_init, 0, /* slot */ 0, /* savepoint size */ berkeley_close_connection, @@ -135,10 +139,13 @@ typedef struct st_berkeley_trx_data { /* General functions */ -handlerton *berkeley_init(void) +bool berkeley_init(void) { DBUG_ENTER("berkeley_init"); + if (have_berkeley_db != SHOW_OPTION_YES) + goto error; + if (!berkeley_tmpdir) berkeley_tmpdir=mysql_tmpdir; if (!berkeley_home) @@ -164,7 +171,7 @@ handlerton *berkeley_init(void) berkeley_log_file_size= max(berkeley_log_file_size, 10*1024*1024L); if (db_env_create(&db_env,0)) - DBUG_RETURN(0); + goto error; db_env->set_errcall(db_env,berkeley_print_error); db_env->set_errpfx(db_env,"bdb"); db_env->set_noticecall(db_env, berkeley_noticecall); @@ -194,13 +201,17 @@ handlerton *berkeley_init(void) { db_env->close(db_env,0); db_env=0; - DBUG_RETURN(0); + goto error; } (void) hash_init(&bdb_open_tables,system_charset_info,32,0,0, (hash_get_key) bdb_get_key,0,0); pthread_mutex_init(&bdb_mutex,MY_MUTEX_INIT_FAST); - DBUG_RETURN(&berkeley_hton); + DBUG_RETURN(FALSE); +error: + have_berkeley_db= SHOW_OPTION_DISABLED; // If we couldn't use handler + berkeley_hton.state= SHOW_OPTION_DISABLED; + DBUG_RETURN(TRUE); } -- cgit v1.2.1