summaryrefslogtreecommitdiff
path: root/sql/ha_federated.cc
diff options
context:
space:
mode:
authorunknown <brian@zim.(none)>2005-10-02 19:44:28 -0700
committerunknown <brian@zim.(none)>2005-10-02 19:44:28 -0700
commit5655d31d5ff64ecea103be523985fa755586673b (patch)
tree72eb47c02b43069ea929c5d757efd985ed319a7b /sql/ha_federated.cc
parenta5dd3d5d8f8e67cb74403f8265b9c61daf9d5ccd (diff)
downloadmariadb-git-5655d31d5ff64ecea103be523985fa755586673b.tar.gz
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
Diffstat (limited to 'sql/ha_federated.cc')
-rw-r--r--sql/ha_federated.cc71
1 files changed, 44 insertions, 27 deletions
diff --git a/sql/ha_federated.cc b/sql/ha_federated.cc
index 9a8b5eb794d..26a9ff47a2e 100644
--- a/sql/ha_federated.cc
+++ b/sql/ha_federated.cc
@@ -363,6 +363,33 @@ pthread_mutex_t federated_mutex; // This is the mutex we use to
static int federated_init= FALSE; // Variable for checking the
// init state of hash
+/* Federated storage engine handlerton */
+
+handlerton federated_hton= {
+ "FEDERATED",
+ SHOW_OPTION_YES,
+ "Federated MySQL storage engine",
+ DB_TYPE_FEDERATED_DB,
+ federated_db_init,
+ 0, /* slot */
+ 0, /* savepoint size. */
+ NULL, /* close_connection */
+ NULL, /* savepoint */
+ NULL, /* rollback to savepoint */
+ NULL, /* release savepoint */
+ NULL, /* commit */
+ NULL, /* rollback */
+ NULL, /* prepare */
+ NULL, /* recover */
+ NULL, /* commit_by_xid */
+ NULL, /* rollback_by_xid */
+ NULL, /* create_cursor_read_view */
+ NULL, /* set_cursor_read_view */
+ NULL, /* close_cursor_read_view */
+ HTON_NO_FLAGS
+};
+
+
/* Function we use in the creation of our hash to get key. */
static byte *federated_get_key(FEDERATED_SHARE *share, uint *length,
@@ -386,10 +413,23 @@ static byte *federated_get_key(FEDERATED_SHARE *share, uint *length,
bool federated_db_init()
{
- federated_init= 1;
- VOID(pthread_mutex_init(&federated_mutex, MY_MUTEX_INIT_FAST));
- return (hash_init(&federated_open_tables, system_charset_info, 32, 0, 0,
- (hash_get_key) federated_get_key, 0, 0));
+ DBUG_ENTER("federated_db_init");
+ if (pthread_mutex_init(&federated_mutex, MY_MUTEX_INIT_FAST))
+ goto error;
+ if (hash_init(&federated_open_tables, system_charset_info, 32, 0, 0,
+ (hash_get_key) federated_get_key, 0, 0))
+ {
+ VOID(pthread_mutex_destroy(&federated_mutex));
+ }
+ else
+ {
+ federated_init= TRUE;
+ DBUG_RETURN(FALSE);
+ }
+error:
+ have_federated_db= SHOW_OPTION_DISABLED; // If we couldn't use handler
+ federated_hton.state= SHOW_OPTION_DISABLED;
+ DBUG_RETURN(TRUE);
}
@@ -694,29 +734,6 @@ error:
}
-/* Federated storage engine handlerton */
-
-handlerton federated_hton= {
- "FEDERATED",
- 0, /* slot */
- 0, /* savepoint size. */
- NULL, /* close_connection */
- NULL, /* savepoint */
- NULL, /* rollback to savepoint */
- NULL, /* release savepoint */
- NULL, /* commit */
- NULL, /* rollback */
- NULL, /* prepare */
- NULL, /* recover */
- NULL, /* commit_by_xid */
- NULL, /* rollback_by_xid */
- NULL, /* create_cursor_read_view */
- NULL, /* set_cursor_read_view */
- NULL, /* close_cursor_read_view */
- HTON_NO_FLAGS
-};
-
-
/*****************************************************************************
** FEDERATED tables
*****************************************************************************/