Skip to content

Commit 0ba8ca2

Browse files
author
brian@zim.(none)
committed
Merge [email protected]:/home/bk/mysql-5.0
into zim.(none):/home/brian/mysql/fix-5.0
2 parents b2f5281 + 54a9589 commit 0ba8ca2

20 files changed

Lines changed: 245 additions & 240 deletions

sql/examples/ha_example.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@
7474

7575

7676
handlerton example_hton= {
77-
"CSV",
77+
"EXAMPLE",
78+
SHOW_OPTION_YES,
79+
"Example storage engine",
80+
DB_TYPE_EXAMPLE_DB,
81+
NULL, /* We do need to write one! */
7882
0, /* slot */
7983
0, /* savepoint size. */
8084
NULL, /* close_connection */

sql/examples/ha_tina.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ static int tina_init= 0;
5656

5757
handlerton tina_hton= {
5858
"CSV",
59+
SHOW_OPTION_YES,
60+
"CSV storage engine",
61+
DB_TYPE_CSV_DB,
62+
NULL, /* One needs to be written! */
5963
0, /* slot */
6064
0, /* savepoint size. */
6165
NULL, /* close_connection */

sql/ha_archive.cc

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
*/
117117

118118
/* If the archive storage engine has been inited */
119-
static bool archive_inited= 0;
119+
static bool archive_inited= FALSE;
120120
/* Variables for archive share methods */
121121
pthread_mutex_t archive_mutex;
122122
static HASH archive_open_tables;
@@ -138,6 +138,10 @@ static HASH archive_open_tables;
138138
/* dummy handlerton - only to have something to return from archive_db_init */
139139
handlerton archive_hton = {
140140
"archive",
141+
SHOW_OPTION_YES,
142+
"Archive storage engine",
143+
DB_TYPE_ARCHIVE_DB,
144+
archive_db_init,
141145
0, /* slot */
142146
0, /* savepoint size. */
143147
NULL, /* close_connection */
@@ -176,18 +180,29 @@ static byte* archive_get_key(ARCHIVE_SHARE *share,uint *length,
176180
void
177181
178182
RETURN
179-
&archive_hton OK
180-
0 Error
183+
FALSE OK
184+
TRUE Error
181185
*/
182186

183-
handlerton *archive_db_init()
187+
bool archive_db_init()
184188
{
185-
archive_inited= 1;
186-
VOID(pthread_mutex_init(&archive_mutex, MY_MUTEX_INIT_FAST));
189+
DBUG_ENTER("archive_db_init");
190+
if (pthread_mutex_init(&archive_mutex, MY_MUTEX_INIT_FAST))
191+
goto error;
187192
if (hash_init(&archive_open_tables, system_charset_info, 32, 0, 0,
188193
(hash_get_key) archive_get_key, 0, 0))
189-
return 0;
190-
return &archive_hton;
194+
{
195+
VOID(pthread_mutex_destroy(&archive_mutex));
196+
}
197+
else
198+
{
199+
archive_inited= TRUE;
200+
DBUG_RETURN(FALSE);
201+
}
202+
error:
203+
have_archive_db= SHOW_OPTION_DISABLED; // If we couldn't use handler
204+
archive_hton.state= SHOW_OPTION_DISABLED;
205+
DBUG_RETURN(TRUE);
191206
}
192207

193208
/*

sql/ha_archive.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,6 @@ class ha_archive: public handler
105105
enum thr_lock_type lock_type);
106106
};
107107

108-
handlerton *archive_db_init(void);
108+
bool archive_db_init(void);
109109
bool archive_db_end(void);
110110

sql/ha_berkeley.cc

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ static int berkeley_rollback(THD *thd, bool all);
109109

110110
handlerton berkeley_hton = {
111111
"BerkeleyDB",
112+
SHOW_OPTION_YES,
113+
"Supports transactions and page-level locking",
114+
DB_TYPE_BERKELEY_DB,
115+
berkeley_init,
112116
0, /* slot */
113117
0, /* savepoint size */
114118
berkeley_close_connection,
@@ -135,10 +139,13 @@ typedef struct st_berkeley_trx_data {
135139

136140
/* General functions */
137141

138-
handlerton *berkeley_init(void)
142+
bool berkeley_init(void)
139143
{
140144
DBUG_ENTER("berkeley_init");
141145

146+
if (have_berkeley_db != SHOW_OPTION_YES)
147+
goto error;
148+
142149
if (!berkeley_tmpdir)
143150
berkeley_tmpdir=mysql_tmpdir;
144151
if (!berkeley_home)
@@ -164,7 +171,7 @@ handlerton *berkeley_init(void)
164171
berkeley_log_file_size= max(berkeley_log_file_size, 10*1024*1024L);
165172

166173
if (db_env_create(&db_env,0))
167-
DBUG_RETURN(0);
174+
goto error;
168175
db_env->set_errcall(db_env,berkeley_print_error);
169176
db_env->set_errpfx(db_env,"bdb");
170177
db_env->set_noticecall(db_env, berkeley_noticecall);
@@ -194,13 +201,17 @@ handlerton *berkeley_init(void)
194201
{
195202
db_env->close(db_env,0);
196203
db_env=0;
197-
DBUG_RETURN(0);
204+
goto error;
198205
}
199206

200207
(void) hash_init(&bdb_open_tables,system_charset_info,32,0,0,
201208
(hash_get_key) bdb_get_key,0,0);
202209
pthread_mutex_init(&bdb_mutex,MY_MUTEX_INIT_FAST);
203-
DBUG_RETURN(&berkeley_hton);
210+
DBUG_RETURN(FALSE);
211+
error:
212+
have_berkeley_db= SHOW_OPTION_DISABLED; // If we couldn't use handler
213+
berkeley_hton.state= SHOW_OPTION_DISABLED;
214+
DBUG_RETURN(TRUE);
204215
}
205216

206217

sql/ha_berkeley.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ extern char *berkeley_home, *berkeley_tmpdir, *berkeley_logdir;
161161
extern long berkeley_lock_scan_time;
162162
extern TYPELIB berkeley_lock_typelib;
163163

164-
handlerton *berkeley_init(void);
164+
bool berkeley_init(void);
165165
bool berkeley_end(void);
166166
bool berkeley_flush_logs(void);
167167
int berkeley_show_logs(Protocol *protocol);

sql/ha_blackhole.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828

2929
handlerton blackhole_hton= {
3030
"BLACKHOLE",
31+
SHOW_OPTION_YES,
32+
"/dev/null storage engine (anything you write to it disappears)",
33+
DB_TYPE_BLACKHOLE_DB,
34+
NULL,
3135
0, /* slot */
3236
0, /* savepoint size. */
3337
NULL, /* close_connection */

sql/ha_federated.cc

Lines changed: 44 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,33 @@ pthread_mutex_t federated_mutex; // This is the mutex we use to
363363
static int federated_init= FALSE; // Variable for checking the
364364
// init state of hash
365365

366+
/* Federated storage engine handlerton */
367+
368+
handlerton federated_hton= {
369+
"FEDERATED",
370+
SHOW_OPTION_YES,
371+
"Federated MySQL storage engine",
372+
DB_TYPE_FEDERATED_DB,
373+
federated_db_init,
374+
0, /* slot */
375+
0, /* savepoint size. */
376+
NULL, /* close_connection */
377+
NULL, /* savepoint */
378+
NULL, /* rollback to savepoint */
379+
NULL, /* release savepoint */
380+
NULL, /* commit */
381+
NULL, /* rollback */
382+
NULL, /* prepare */
383+
NULL, /* recover */
384+
NULL, /* commit_by_xid */
385+
NULL, /* rollback_by_xid */
386+
NULL, /* create_cursor_read_view */
387+
NULL, /* set_cursor_read_view */
388+
NULL, /* close_cursor_read_view */
389+
HTON_ALTER_NOT_SUPPORTED
390+
};
391+
392+
366393
/* Function we use in the creation of our hash to get key. */
367394

368395
static byte *federated_get_key(FEDERATED_SHARE *share, uint *length,
@@ -386,10 +413,23 @@ static byte *federated_get_key(FEDERATED_SHARE *share, uint *length,
386413

387414
bool federated_db_init()
388415
{
389-
federated_init= 1;
390-
VOID(pthread_mutex_init(&federated_mutex, MY_MUTEX_INIT_FAST));
391-
return (hash_init(&federated_open_tables, system_charset_info, 32, 0, 0,
392-
(hash_get_key) federated_get_key, 0, 0));
416+
DBUG_ENTER("federated_db_init");
417+
if (pthread_mutex_init(&federated_mutex, MY_MUTEX_INIT_FAST))
418+
goto error;
419+
if (hash_init(&federated_open_tables, system_charset_info, 32, 0, 0,
420+
(hash_get_key) federated_get_key, 0, 0))
421+
{
422+
VOID(pthread_mutex_destroy(&federated_mutex));
423+
}
424+
else
425+
{
426+
federated_init= TRUE;
427+
DBUG_RETURN(FALSE);
428+
}
429+
error:
430+
have_federated_db= SHOW_OPTION_DISABLED; // If we couldn't use handler
431+
federated_hton.state= SHOW_OPTION_DISABLED;
432+
DBUG_RETURN(TRUE);
393433
}
394434

395435

@@ -694,29 +734,6 @@ static int parse_url(FEDERATED_SHARE *share, TABLE *table,
694734
}
695735

696736

697-
/* Federated storage engine handlerton */
698-
699-
handlerton federated_hton= {
700-
"FEDERATED",
701-
0, /* slot */
702-
0, /* savepoint size. */
703-
NULL, /* close_connection */
704-
NULL, /* savepoint */
705-
NULL, /* rollback to savepoint */
706-
NULL, /* release savepoint */
707-
NULL, /* commit */
708-
NULL, /* rollback */
709-
NULL, /* prepare */
710-
NULL, /* recover */
711-
NULL, /* commit_by_xid */
712-
NULL, /* rollback_by_xid */
713-
NULL, /* create_cursor_read_view */
714-
NULL, /* set_cursor_read_view */
715-
NULL, /* close_cursor_read_view */
716-
HTON_ALTER_NOT_SUPPORTED
717-
};
718-
719-
720737
/*****************************************************************************
721738
** FEDERATED tables
722739
*****************************************************************************/

sql/ha_heap.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525

2626
handlerton heap_hton= {
2727
"MEMORY",
28+
SHOW_OPTION_YES,
29+
"Hash based, stored in memory, useful for temporary tables",
30+
DB_TYPE_HEAP,
31+
NULL,
2832
0, /* slot */
2933
0, /* savepoint size. */
3034
NULL, /* close_connection */

sql/ha_innodb.cc

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,10 @@ static int innobase_release_savepoint(THD* thd, void *savepoint);
208208

209209
handlerton innobase_hton = {
210210
"InnoDB",
211+
SHOW_OPTION_YES,
212+
"Supports transactions, row-level locking, and foreign keys",
213+
DB_TYPE_INNODB,
214+
innobase_init,
211215
0, /* slot */
212216
sizeof(trx_named_savept_t), /* savepoint size. TODO: use it */
213217
innobase_close_connection,
@@ -1188,7 +1192,7 @@ ha_innobase::init_table_handle_for_HANDLER(void)
11881192
/*************************************************************************
11891193
Opens an InnoDB database. */
11901194

1191-
handlerton*
1195+
bool
11921196
innobase_init(void)
11931197
/*===============*/
11941198
/* out: &innobase_hton, or NULL on error */
@@ -1200,6 +1204,9 @@ innobase_init(void)
12001204

12011205
DBUG_ENTER("innobase_init");
12021206

1207+
if (have_innodb != SHOW_OPTION_YES)
1208+
goto error;
1209+
12031210
ut_a(DATA_MYSQL_TRUE_VARCHAR == (ulint)MYSQL_TYPE_VARCHAR);
12041211

12051212
os_innodb_umask = (ulint)my_umask;
@@ -1267,7 +1274,7 @@ innobase_init(void)
12671274
"InnoDB: syntax error in innodb_data_file_path");
12681275
my_free(internal_innobase_data_file_path,
12691276
MYF(MY_ALLOW_ZERO_PTR));
1270-
DBUG_RETURN(0);
1277+
goto error;
12711278
}
12721279

12731280
/* -------------- Log files ---------------------------*/
@@ -1298,7 +1305,7 @@ innobase_init(void)
12981305

12991306
my_free(internal_innobase_data_file_path,
13001307
MYF(MY_ALLOW_ZERO_PTR));
1301-
DBUG_RETURN(0);
1308+
goto error;
13021309
}
13031310

13041311
/* --------------------------------------------------*/
@@ -1386,7 +1393,7 @@ innobase_init(void)
13861393
if (err != DB_SUCCESS) {
13871394
my_free(internal_innobase_data_file_path,
13881395
MYF(MY_ALLOW_ZERO_PTR));
1389-
DBUG_RETURN(0);
1396+
goto error;
13901397
}
13911398

13921399
(void) hash_init(&innobase_open_tables,system_charset_info, 32, 0, 0,
@@ -1413,7 +1420,11 @@ innobase_init(void)
14131420
glob_mi.pos = trx_sys_mysql_master_log_pos;
14141421
}
14151422
*/
1416-
DBUG_RETURN(&innobase_hton);
1423+
DBUG_RETURN(FALSE);
1424+
error:
1425+
have_innodb= SHOW_OPTION_DISABLED; // If we couldn't use handler
1426+
innobase_hton.state= SHOW_OPTION_DISABLED;
1427+
DBUG_RETURN(TRUE);
14171428
}
14181429

14191430
/***********************************************************************

0 commit comments

Comments
 (0)