Commit 11be8401 authored by brian@zim.(none)'s avatar brian@zim.(none)

Merge baker@bk-internal.mysql.com:/home/bk/mysql-5.0

into  zim.(none):/home/brian/mysql/fix-5.0
parents fe26e59d 2a42afd1
...@@ -323,17 +323,17 @@ execute stmt4; ...@@ -323,17 +323,17 @@ execute stmt4;
Engine Support Comment Engine Support Comment
MyISAM YES/NO Default engine as of MySQL 3.23 with great performance MyISAM YES/NO Default engine as of MySQL 3.23 with great performance
MEMORY YES/NO Hash based, stored in memory, useful for temporary tables MEMORY YES/NO Hash based, stored in memory, useful for temporary tables
MRG_MYISAM YES/NO Collection of identical MyISAM tables
ISAM YES/NO Obsolete storage engine, now replaced by MyISAM
MRG_ISAM YES/NO Obsolete storage engine, now replaced by MERGE
InnoDB YES/NO Supports transactions, row-level locking, and foreign keys InnoDB YES/NO Supports transactions, row-level locking, and foreign keys
BERKELEYDB YES/NO Supports transactions and page-level locking BerkeleyDB YES/NO Supports transactions and page-level locking
NDBCLUSTER YES/NO Clustered, fault-tolerant, memory-based tables BLACKHOLE YES/NO /dev/null storage engine (anything you write to it disappears)
EXAMPLE YES/NO Example storage engine EXAMPLE YES/NO Example storage engine
ARCHIVE YES/NO Archive storage engine ARCHIVE YES/NO Archive storage engine
CSV YES/NO CSV storage engine CSV YES/NO CSV storage engine
ndbcluster YES/NO Clustered, fault-tolerant, memory-based tables
FEDERATED YES/NO Federated MySQL storage engine FEDERATED YES/NO Federated MySQL storage engine
BLACKHOLE YES/NO /dev/null storage engine (anything you write to it disappears) MRG_MYISAM YES/NO Collection of identical MyISAM tables
binlog YES/NO This is a meta storage engine to represent the binlog in a transaction
ISAM YES/NO Obsolete storage engine
drop table if exists t5; drop table if exists t5;
prepare stmt1 from ' drop table if exists t5 ' ; prepare stmt1 from ' drop table if exists t5 ' ;
execute stmt1 ; execute stmt1 ;
......
...@@ -74,7 +74,11 @@ ...@@ -74,7 +74,11 @@
handlerton example_hton= { handlerton example_hton= {
"CSV", "EXAMPLE",
SHOW_OPTION_YES,
"Example storage engine",
DB_TYPE_EXAMPLE_DB,
NULL, /* We do need to write one! */
0, /* slot */ 0, /* slot */
0, /* savepoint size. */ 0, /* savepoint size. */
NULL, /* close_connection */ NULL, /* close_connection */
......
...@@ -56,6 +56,10 @@ static int tina_init= 0; ...@@ -56,6 +56,10 @@ static int tina_init= 0;
handlerton tina_hton= { handlerton tina_hton= {
"CSV", "CSV",
SHOW_OPTION_YES,
"CSV storage engine",
DB_TYPE_CSV_DB,
NULL, /* One needs to be written! */
0, /* slot */ 0, /* slot */
0, /* savepoint size. */ 0, /* savepoint size. */
NULL, /* close_connection */ NULL, /* close_connection */
...@@ -857,21 +861,6 @@ THR_LOCK_DATA **ha_tina::store_lock(THD *thd, ...@@ -857,21 +861,6 @@ THR_LOCK_DATA **ha_tina::store_lock(THD *thd,
return to; return to;
} }
/*
Range optimizer calls this.
I need to update the information on this.
*/
ha_rows ha_tina::records_in_range(int inx,
const byte *start_key,uint start_key_len,
enum ha_rkey_function start_search_flag,
const byte *end_key,uint end_key_len,
enum ha_rkey_function end_search_flag)
{
DBUG_ENTER("ha_tina::records_in_range ");
DBUG_RETURN(records); // Good guess
}
/* /*
Create a table. You do not want to leave the table open after a call to Create a table. You do not want to leave the table open after a call to
this (the database will call ::open() if it needs to). this (the database will call ::open() if it needs to).
......
...@@ -78,7 +78,6 @@ public: ...@@ -78,7 +78,6 @@ public:
*/ */
virtual double scan_time() { return (double) (records+deleted) / 20.0+10; } virtual double scan_time() { return (double) (records+deleted) / 20.0+10; }
/* The next method will never be called */ /* The next method will never be called */
virtual double read_time(ha_rows rows) { DBUG_ASSERT(0); return((double) rows / 20.0+1); }
virtual bool fast_key_read() { return 1;} virtual bool fast_key_read() { return 1;}
/* /*
TODO: return actual upper bound of number of records in the table. TODO: return actual upper bound of number of records in the table.
...@@ -110,12 +109,6 @@ public: ...@@ -110,12 +109,6 @@ public:
int reset(void); int reset(void);
int external_lock(THD *thd, int lock_type); int external_lock(THD *thd, int lock_type);
int delete_all_rows(void); int delete_all_rows(void);
ha_rows records_in_range(int inx, const byte *start_key,uint start_key_len,
enum ha_rkey_function start_search_flag,
const byte *end_key,uint end_key_len,
enum ha_rkey_function end_search_flag);
// int delete_table(const char *from);
// int rename_table(const char * from, const char * to);
int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info); int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info);
THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
......
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
*/ */
/* If the archive storage engine has been inited */ /* If the archive storage engine has been inited */
static bool archive_inited= 0; static bool archive_inited= FALSE;
/* Variables for archive share methods */ /* Variables for archive share methods */
pthread_mutex_t archive_mutex; pthread_mutex_t archive_mutex;
static HASH archive_open_tables; static HASH archive_open_tables;
...@@ -137,7 +137,11 @@ static HASH archive_open_tables; ...@@ -137,7 +137,11 @@ static HASH archive_open_tables;
/* dummy handlerton - only to have something to return from archive_db_init */ /* dummy handlerton - only to have something to return from archive_db_init */
handlerton archive_hton = { handlerton archive_hton = {
"archive", "ARCHIVE",
SHOW_OPTION_YES,
"Archive storage engine",
DB_TYPE_ARCHIVE_DB,
archive_db_init,
0, /* slot */ 0, /* slot */
0, /* savepoint size. */ 0, /* savepoint size. */
NULL, /* close_connection */ NULL, /* close_connection */
...@@ -176,18 +180,28 @@ static byte* archive_get_key(ARCHIVE_SHARE *share,uint *length, ...@@ -176,18 +180,28 @@ static byte* archive_get_key(ARCHIVE_SHARE *share,uint *length,
void void
RETURN RETURN
&archive_hton OK FALSE OK
0 Error TRUE Error
*/ */
handlerton *archive_db_init() bool archive_db_init()
{ {
archive_inited= 1; DBUG_ENTER("archive_db_init");
VOID(pthread_mutex_init(&archive_mutex, MY_MUTEX_INIT_FAST)); if (pthread_mutex_init(&archive_mutex, MY_MUTEX_INIT_FAST))
goto error;
if (hash_init(&archive_open_tables, system_charset_info, 32, 0, 0, if (hash_init(&archive_open_tables, system_charset_info, 32, 0, 0,
(hash_get_key) archive_get_key, 0, 0)) (hash_get_key) archive_get_key, 0, 0))
return 0; {
return &archive_hton; VOID(pthread_mutex_destroy(&archive_mutex));
}
else
{
archive_inited= TRUE;
DBUG_RETURN(FALSE);
}
error:
have_archive_db= SHOW_OPTION_DISABLED; // If we couldn't use handler
DBUG_RETURN(TRUE);
} }
/* /*
......
...@@ -105,6 +105,6 @@ public: ...@@ -105,6 +105,6 @@ public:
enum thr_lock_type lock_type); enum thr_lock_type lock_type);
}; };
handlerton *archive_db_init(void); bool archive_db_init(void);
bool archive_db_end(void); bool archive_db_end(void);
...@@ -109,6 +109,10 @@ static int berkeley_rollback(THD *thd, bool all); ...@@ -109,6 +109,10 @@ static int berkeley_rollback(THD *thd, bool all);
handlerton berkeley_hton = { handlerton berkeley_hton = {
"BerkeleyDB", "BerkeleyDB",
SHOW_OPTION_YES,
"Supports transactions and page-level locking",
DB_TYPE_BERKELEY_DB,
berkeley_init,
0, /* slot */ 0, /* slot */
0, /* savepoint size */ 0, /* savepoint size */
berkeley_close_connection, berkeley_close_connection,
...@@ -135,10 +139,13 @@ typedef struct st_berkeley_trx_data { ...@@ -135,10 +139,13 @@ typedef struct st_berkeley_trx_data {
/* General functions */ /* General functions */
handlerton *berkeley_init(void) bool berkeley_init(void)
{ {
DBUG_ENTER("berkeley_init"); DBUG_ENTER("berkeley_init");
if (have_berkeley_db != SHOW_OPTION_YES)
goto error;
if (!berkeley_tmpdir) if (!berkeley_tmpdir)
berkeley_tmpdir=mysql_tmpdir; berkeley_tmpdir=mysql_tmpdir;
if (!berkeley_home) if (!berkeley_home)
...@@ -164,7 +171,7 @@ handlerton *berkeley_init(void) ...@@ -164,7 +171,7 @@ handlerton *berkeley_init(void)
berkeley_log_file_size= max(berkeley_log_file_size, 10*1024*1024L); berkeley_log_file_size= max(berkeley_log_file_size, 10*1024*1024L);
if (db_env_create(&db_env,0)) if (db_env_create(&db_env,0))
DBUG_RETURN(0); goto error;
db_env->set_errcall(db_env,berkeley_print_error); db_env->set_errcall(db_env,berkeley_print_error);
db_env->set_errpfx(db_env,"bdb"); db_env->set_errpfx(db_env,"bdb");
db_env->set_noticecall(db_env, berkeley_noticecall); db_env->set_noticecall(db_env, berkeley_noticecall);
...@@ -194,13 +201,16 @@ handlerton *berkeley_init(void) ...@@ -194,13 +201,16 @@ handlerton *berkeley_init(void)
{ {
db_env->close(db_env,0); db_env->close(db_env,0);
db_env=0; db_env=0;
DBUG_RETURN(0); goto error;
} }
(void) hash_init(&bdb_open_tables,system_charset_info,32,0,0, (void) hash_init(&bdb_open_tables,system_charset_info,32,0,0,
(hash_get_key) bdb_get_key,0,0); (hash_get_key) bdb_get_key,0,0);
pthread_mutex_init(&bdb_mutex,MY_MUTEX_INIT_FAST); 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
DBUG_RETURN(TRUE);
} }
......
...@@ -161,7 +161,7 @@ extern char *berkeley_home, *berkeley_tmpdir, *berkeley_logdir; ...@@ -161,7 +161,7 @@ extern char *berkeley_home, *berkeley_tmpdir, *berkeley_logdir;
extern long berkeley_lock_scan_time; extern long berkeley_lock_scan_time;
extern TYPELIB berkeley_lock_typelib; extern TYPELIB berkeley_lock_typelib;
handlerton *berkeley_init(void); bool berkeley_init(void);
bool berkeley_end(void); bool berkeley_end(void);
bool berkeley_flush_logs(void); bool berkeley_flush_logs(void);
int berkeley_show_logs(Protocol *protocol); int berkeley_show_logs(Protocol *protocol);
...@@ -28,6 +28,10 @@ ...@@ -28,6 +28,10 @@
handlerton blackhole_hton= { handlerton blackhole_hton= {
"BLACKHOLE", "BLACKHOLE",
SHOW_OPTION_YES,
"/dev/null storage engine (anything you write to it disappears)",
DB_TYPE_BLACKHOLE_DB,
NULL,
0, /* slot */ 0, /* slot */
0, /* savepoint size. */ 0, /* savepoint size. */
NULL, /* close_connection */ NULL, /* close_connection */
......
...@@ -363,6 +363,33 @@ pthread_mutex_t federated_mutex; // This is the mutex we use to ...@@ -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 static int federated_init= FALSE; // Variable for checking the
// init state of hash // 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_ALTER_NOT_SUPPORTED
};
/* Function we use in the creation of our hash to get key. */ /* Function we use in the creation of our hash to get key. */
static byte *federated_get_key(FEDERATED_SHARE *share, uint *length, static byte *federated_get_key(FEDERATED_SHARE *share, uint *length,
...@@ -386,10 +413,22 @@ static byte *federated_get_key(FEDERATED_SHARE *share, uint *length, ...@@ -386,10 +413,22 @@ static byte *federated_get_key(FEDERATED_SHARE *share, uint *length,
bool federated_db_init() bool federated_db_init()
{ {
federated_init= 1; DBUG_ENTER("federated_db_init");
VOID(pthread_mutex_init(&federated_mutex, MY_MUTEX_INIT_FAST)); if (pthread_mutex_init(&federated_mutex, MY_MUTEX_INIT_FAST))
return (hash_init(&federated_open_tables, system_charset_info, 32, 0, 0, goto error;
(hash_get_key) federated_get_key, 0, 0)); 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
DBUG_RETURN(TRUE);
} }
...@@ -694,29 +733,6 @@ error: ...@@ -694,29 +733,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_ALTER_NOT_SUPPORTED
};
/***************************************************************************** /*****************************************************************************
** FEDERATED tables ** FEDERATED tables
*****************************************************************************/ *****************************************************************************/
......
...@@ -25,6 +25,10 @@ ...@@ -25,6 +25,10 @@
handlerton heap_hton= { handlerton heap_hton= {
"MEMORY", "MEMORY",
SHOW_OPTION_YES,
"Hash based, stored in memory, useful for temporary tables",
DB_TYPE_HEAP,
NULL,
0, /* slot */ 0, /* slot */
0, /* savepoint size. */ 0, /* savepoint size. */
NULL, /* close_connection */ NULL, /* close_connection */
......
...@@ -208,6 +208,10 @@ static int innobase_release_savepoint(THD* thd, void *savepoint); ...@@ -208,6 +208,10 @@ static int innobase_release_savepoint(THD* thd, void *savepoint);
handlerton innobase_hton = { handlerton innobase_hton = {
"InnoDB", "InnoDB",
SHOW_OPTION_YES,
"Supports transactions, row-level locking, and foreign keys",
DB_TYPE_INNODB,
innobase_init,
0, /* slot */ 0, /* slot */
sizeof(trx_named_savept_t), /* savepoint size. TODO: use it */ sizeof(trx_named_savept_t), /* savepoint size. TODO: use it */
innobase_close_connection, innobase_close_connection,
...@@ -1188,7 +1192,7 @@ ha_innobase::init_table_handle_for_HANDLER(void) ...@@ -1188,7 +1192,7 @@ ha_innobase::init_table_handle_for_HANDLER(void)
/************************************************************************* /*************************************************************************
Opens an InnoDB database. */ Opens an InnoDB database. */
handlerton* bool
innobase_init(void) innobase_init(void)
/*===============*/ /*===============*/
/* out: &innobase_hton, or NULL on error */ /* out: &innobase_hton, or NULL on error */
...@@ -1200,6 +1204,9 @@ innobase_init(void) ...@@ -1200,6 +1204,9 @@ innobase_init(void)
DBUG_ENTER("innobase_init"); DBUG_ENTER("innobase_init");
if (have_innodb != SHOW_OPTION_YES)
goto error;
ut_a(DATA_MYSQL_TRUE_VARCHAR == (ulint)MYSQL_TYPE_VARCHAR); ut_a(DATA_MYSQL_TRUE_VARCHAR == (ulint)MYSQL_TYPE_VARCHAR);
os_innodb_umask = (ulint)my_umask; os_innodb_umask = (ulint)my_umask;
...@@ -1267,7 +1274,7 @@ innobase_init(void) ...@@ -1267,7 +1274,7 @@ innobase_init(void)
"InnoDB: syntax error in innodb_data_file_path"); "InnoDB: syntax error in innodb_data_file_path");
my_free(internal_innobase_data_file_path, my_free(internal_innobase_data_file_path,
MYF(MY_ALLOW_ZERO_PTR)); MYF(MY_ALLOW_ZERO_PTR));
DBUG_RETURN(0); goto error;
} }
/* -------------- Log files ---------------------------*/ /* -------------- Log files ---------------------------*/
...@@ -1298,7 +1305,7 @@ innobase_init(void) ...@@ -1298,7 +1305,7 @@ innobase_init(void)
my_free(internal_innobase_data_file_path, my_free(internal_innobase_data_file_path,
MYF(MY_ALLOW_ZERO_PTR)); MYF(MY_ALLOW_ZERO_PTR));
DBUG_RETURN(0); goto error;
} }
/* --------------------------------------------------*/ /* --------------------------------------------------*/
...@@ -1386,7 +1393,7 @@ innobase_init(void) ...@@ -1386,7 +1393,7 @@ innobase_init(void)
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
my_free(internal_innobase_data_file_path, my_free(internal_innobase_data_file_path,
MYF(MY_ALLOW_ZERO_PTR)); MYF(MY_ALLOW_ZERO_PTR));
DBUG_RETURN(0); goto error;
} }
(void) hash_init(&innobase_open_tables,system_charset_info, 32, 0, 0, (void) hash_init(&innobase_open_tables,system_charset_info, 32, 0, 0,
...@@ -1413,7 +1420,10 @@ innobase_init(void) ...@@ -1413,7 +1420,10 @@ innobase_init(void)
glob_mi.pos = trx_sys_mysql_master_log_pos; glob_mi.pos = trx_sys_mysql_master_log_pos;
} }
*/ */
DBUG_RETURN(&innobase_hton); DBUG_RETURN(FALSE);
error:
have_innodb= SHOW_OPTION_DISABLED; // If we couldn't use handler
DBUG_RETURN(TRUE);
} }
/*********************************************************************** /***********************************************************************
......
...@@ -241,7 +241,7 @@ extern ulong srv_commit_concurrency; ...@@ -241,7 +241,7 @@ extern ulong srv_commit_concurrency;
extern TYPELIB innobase_lock_typelib; extern TYPELIB innobase_lock_typelib;
handlerton *innobase_init(void); bool innobase_init(void);
bool innobase_end(void); bool innobase_end(void);
bool innobase_flush_logs(void); bool innobase_flush_logs(void);
uint innobase_get_free_space(void); uint innobase_get_free_space(void);
......
...@@ -54,6 +54,10 @@ TYPELIB myisam_stats_method_typelib= { ...@@ -54,6 +54,10 @@ TYPELIB myisam_stats_method_typelib= {
handlerton myisam_hton= { handlerton myisam_hton= {
"MyISAM", "MyISAM",
SHOW_OPTION_YES,
"Default engine as of MySQL 3.23 with great performance",
DB_TYPE_MYISAM,
NULL,
0, /* slot */ 0, /* slot */
0, /* savepoint size. */ 0, /* savepoint size. */
NULL, /* close_connection */ NULL, /* close_connection */
......
...@@ -36,6 +36,10 @@ ...@@ -36,6 +36,10 @@
handlerton myisammrg_hton= { handlerton myisammrg_hton= {
"MRG_MYISAM", "MRG_MYISAM",
SHOW_OPTION_YES,
"Collection of identical MyISAM tables",
DB_TYPE_MRG_MYISAM,
NULL,
0, /* slot */ 0, /* slot */
0, /* savepoint size. */ 0, /* savepoint size. */
NULL, /* close_connection */ NULL, /* close_connection */
......
...@@ -51,6 +51,10 @@ static int ndbcluster_rollback(THD *thd, bool all); ...@@ -51,6 +51,10 @@ static int ndbcluster_rollback(THD *thd, bool all);
handlerton ndbcluster_hton = { handlerton ndbcluster_hton = {
"ndbcluster", "ndbcluster",
SHOW_OPTION_YES,
"Clustered, fault-tolerant, memory-based tables",
DB_TYPE_NDBCLUSTER,
ndbcluster_init,
0, /* slot */ 0, /* slot */
0, /* savepoint size */ 0, /* savepoint size */
ndbcluster_close_connection, ndbcluster_close_connection,
...@@ -4735,11 +4739,14 @@ static int connect_callback() ...@@ -4735,11 +4739,14 @@ static int connect_callback()
return 0; return 0;
} }
handlerton * bool ndbcluster_init()
ndbcluster_init()
{ {
int res; int res;
DBUG_ENTER("ndbcluster_init"); DBUG_ENTER("ndbcluster_init");
if (have_ndbcluster != SHOW_OPTION_YES)
goto ndbcluster_init_error;
// Set connectstring if specified // Set connectstring if specified
if (opt_ndbcluster_connectstring != 0) if (opt_ndbcluster_connectstring != 0)
DBUG_PRINT("connectstring", ("%s", opt_ndbcluster_connectstring)); DBUG_PRINT("connectstring", ("%s", opt_ndbcluster_connectstring));
...@@ -4820,16 +4827,17 @@ ndbcluster_init() ...@@ -4820,16 +4827,17 @@ ndbcluster_init()
} }
ndbcluster_inited= 1; ndbcluster_inited= 1;
DBUG_RETURN(&ndbcluster_hton); DBUG_RETURN(FALSE);
ndbcluster_init_error: ndbcluster_init_error:
if (g_ndb) if (g_ndb)
delete g_ndb; delete g_ndb;
g_ndb= NULL; g_ndb= NULL;
if (g_ndb_cluster_connection) if (g_ndb_cluster_connection)
delete g_ndb_cluster_connection; delete g_ndb_cluster_connection;
g_ndb_cluster_connection= NULL; g_ndb_cluster_connection= NULL;
DBUG_RETURN(NULL); have_ndbcluster= SHOW_OPTION_DISABLED; // If we couldn't use handler
DBUG_RETURN(TRUE);
} }
......
...@@ -716,7 +716,7 @@ private: ...@@ -716,7 +716,7 @@ private:
extern struct show_var_st ndb_status_variables[]; extern struct show_var_st ndb_status_variables[];
handlerton *ndbcluster_init(void); bool ndbcluster_init(void);
bool ndbcluster_end(void); bool ndbcluster_end(void);
int ndbcluster_discover(THD* thd, const char* dbname, const char* name, int ndbcluster_discover(THD* thd, const char* dbname, const char* name,
......
This diff is collapsed.
...@@ -304,6 +304,27 @@ typedef struct ...@@ -304,6 +304,27 @@ typedef struct
storage engine name as it should be printed to a user storage engine name as it should be printed to a user
*/ */
const char *name; const char *name;
/*
Historical marker for if the engine is available of not
*/
SHOW_COMP_OPTION state;
/*
A comment used by SHOW to describe an engine.
*/
const char *comment;
/*
Historical number used for frm file to determine the correct storage engine.
This is going away and new engines will just use "name" for this.
*/
enum db_type db_type;
/*
Method that initizlizes a storage engine
*/
bool (*init)();
/* /*
each storage engine has it's own memory area (actually a pointer) each storage engine has it's own memory area (actually a pointer)
in the thd, for storing per-connection information. in the thd, for storing per-connection information.
...@@ -363,14 +384,6 @@ typedef struct ...@@ -363,14 +384,6 @@ typedef struct
uint32 flags; /* global handler flags */ uint32 flags; /* global handler flags */
} handlerton; } handlerton;
struct show_table_type_st {
const char *type;
SHOW_COMP_OPTION *value;
const char *comment;
enum db_type db_type;
handlerton *ht;
};
struct show_table_alias_st { struct show_table_alias_st {
const char *alias; const char *alias;
const char *type; const char *type;
...@@ -837,11 +850,10 @@ public: ...@@ -837,11 +850,10 @@ public:
/* Some extern variables used with handlers */ /* Some extern variables used with handlers */
extern struct show_table_type_st sys_table_types[]; extern handlerton *sys_table_types[];
extern const char *ha_row_type[]; extern const char *ha_row_type[];
extern TYPELIB tx_isolation_typelib; extern TYPELIB tx_isolation_typelib;
extern TYPELIB myisam_stats_method_typelib; extern TYPELIB myisam_stats_method_typelib;
extern handlerton *handlertons[MAX_HA];
extern ulong total_ha, total_ha_2pc; extern ulong total_ha, total_ha_2pc;
/* Wrapper functions */ /* Wrapper functions */
......
...@@ -38,6 +38,7 @@ ulong sync_binlog_counter= 0; ...@@ -38,6 +38,7 @@ ulong sync_binlog_counter= 0;
static bool test_if_number(const char *str, static bool test_if_number(const char *str,
long *res, bool allow_wildcards); long *res, bool allow_wildcards);
static bool binlog_init();
static int binlog_close_connection(THD *thd); static int binlog_close_connection(THD *thd);
static int binlog_savepoint_set(THD *thd, void *sv); static int binlog_savepoint_set(THD *thd, void *sv);
static int binlog_savepoint_rollback(THD *thd, void *sv); static int binlog_savepoint_rollback(THD *thd, void *sv);
...@@ -45,8 +46,12 @@ static int binlog_commit(THD *thd, bool all); ...@@ -45,8 +46,12 @@ static int binlog_commit(THD *thd, bool all);
static int binlog_rollback(THD *thd, bool all); static int binlog_rollback(THD *thd, bool all);
static int binlog_prepare(THD *thd, bool all); static int binlog_prepare(THD *thd, bool all);
static handlerton binlog_hton = { handlerton binlog_hton = {
"binlog", "binlog",
SHOW_OPTION_YES,
"This is a meta storage engine to represent the binlog in a transaction",
DB_TYPE_UNKNOWN, /* IGNORE for now */
binlog_init,
0, 0,
sizeof(my_off_t), /* savepoint size = binlog offset */ sizeof(my_off_t), /* savepoint size = binlog offset */
binlog_close_connection, binlog_close_connection,
...@@ -71,9 +76,9 @@ static handlerton binlog_hton = { ...@@ -71,9 +76,9 @@ static handlerton binlog_hton = {
should be moved here. should be moved here.
*/ */
handlerton *binlog_init() bool binlog_init()
{ {
return &binlog_hton; return false;
} }
static int binlog_close_connection(THD *thd) static int binlog_close_connection(THD *thd)
......
...@@ -1070,7 +1070,6 @@ bool fn_format_relative_to_data_home(my_string to, const char *name, ...@@ -1070,7 +1070,6 @@ bool fn_format_relative_to_data_home(my_string to, const char *name,
const char *dir, const char *extension); const char *dir, const char *extension);
File open_binlog(IO_CACHE *log, const char *log_file_name, File open_binlog(IO_CACHE *log, const char *log_file_name,
const char **errmsg); const char **errmsg);
handlerton *binlog_init();
/* mysqld.cc */ /* mysqld.cc */
extern void yyerror(const char*); extern void yyerror(const char*);
......
...@@ -67,18 +67,18 @@ bool mysqld_show_storage_engines(THD *thd) ...@@ -67,18 +67,18 @@ bool mysqld_show_storage_engines(THD *thd)
const char *default_type_name= const char *default_type_name=
ha_get_storage_engine((enum db_type)thd->variables.table_type); ha_get_storage_engine((enum db_type)thd->variables.table_type);
show_table_type_st *types; handlerton **types;
for (types= sys_table_types; types->type; types++) for (types= sys_table_types; *types; types++)
{ {
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store(types->type, system_charset_info); protocol->store((*types)->name, system_charset_info);
const char *option_name= show_comp_option_name[(int) *types->value]; const char *option_name= show_comp_option_name[(int) (*types)->state];
if (*types->value == SHOW_OPTION_YES && if ((*types)->state == SHOW_OPTION_YES &&
!my_strcasecmp(system_charset_info, default_type_name, types->type)) !my_strcasecmp(system_charset_info, default_type_name, (*types)->name))
option_name= "DEFAULT"; option_name= "DEFAULT";
protocol->store(option_name, system_charset_info); protocol->store(option_name, system_charset_info);
protocol->store(types->comment, system_charset_info); protocol->store((*types)->comment, system_charset_info);
if (protocol->write()) if (protocol->write())
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment