diff options
author | unknown <brian@zim.(none)> | 2006-09-30 18:44:42 -0700 |
---|---|---|
committer | unknown <brian@zim.(none)> | 2006-09-30 18:44:42 -0700 |
commit | ab6830a09439eebb6ab9d50cfbba2658ccdc953e (patch) | |
tree | 51071e4478e163ac38d94418fa28ed75416be90a /sql | |
parent | a4ac09c14c29a36e3808c4125e8c9ba3dfec4726 (diff) | |
parent | 40bf7b0ae2b109e677efb5483c30607171a87afe (diff) | |
download | mariadb-git-ab6830a09439eebb6ab9d50cfbba2658ccdc953e.tar.gz |
Merge zim.(none):/home/brian/mysql/merge-5.1
into zim.(none):/home/brian/mysql/arch-5.1
sql/mysql_priv.h:
Auto merged
sql/share/errmsg.txt:
Auto merged
sql/sql_show.cc:
Auto merged
sql/handler.h:
Merge from G's work
sql/sql_cursor.cc:
Merge from G's work
storage/csv/ha_tina.cc:
Merge of G's work
storage/innobase/handler/ha_innodb.cc:
Merge of G's work
storage/innobase/handler/ha_innodb.h:
Merge of G's work
storage/myisam/ha_myisam.cc:
Merge of G's work
Diffstat (limited to 'sql')
-rw-r--r-- | sql/ha_ndbcluster.cc | 65 | ||||
-rw-r--r-- | sql/ha_ndbcluster.h | 2 | ||||
-rw-r--r-- | sql/ha_ndbcluster_binlog.cc | 6 | ||||
-rw-r--r-- | sql/ha_partition.cc | 18 | ||||
-rw-r--r-- | sql/ha_partition.h | 4 | ||||
-rw-r--r-- | sql/handler.cc | 97 | ||||
-rw-r--r-- | sql/handler.h | 74 | ||||
-rw-r--r-- | sql/log.cc | 29 | ||||
-rw-r--r-- | sql/mysql_priv.h | 12 | ||||
-rw-r--r-- | sql/mysqld.cc | 8 | ||||
-rw-r--r-- | sql/partition_info.cc | 6 | ||||
-rw-r--r-- | sql/share/errmsg.txt | 6 | ||||
-rw-r--r-- | sql/sql_cache.cc | 4 | ||||
-rw-r--r-- | sql/sql_cursor.cc | 12 | ||||
-rw-r--r-- | sql/sql_show.cc | 2 | ||||
-rw-r--r-- | sql/sql_tablespace.cc | 4 |
16 files changed, 197 insertions, 152 deletions
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 157af825063..fffa87daf64 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -75,17 +75,25 @@ static const int max_transactions= 3; // should really be 2 but there is a trans static uint ndbcluster_partition_flags(); static uint ndbcluster_alter_table_flags(uint flags); static int ndbcluster_init(void *); -static int ndbcluster_end(ha_panic_function flag); -static bool ndbcluster_show_status(THD*,stat_print_fn *,enum ha_stat_type); -static int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info); -static int ndbcluster_fill_files_table(THD *thd, TABLE_LIST *tables, COND *cond); - -handlerton *ndbcluster_hton; - -static handler *ndbcluster_create_handler(TABLE_SHARE *table, +static int ndbcluster_end(handlerton *hton, ha_panic_function flag); +static bool ndbcluster_show_status(handlerton *hton, THD*, + stat_print_fn *, + enum ha_stat_type); +static int ndbcluster_alter_tablespace(handlerton *hton, + THD* thd, + st_alter_tablespace *info); +static int ndbcluster_fill_files_table(handlerton *hton, + THD *thd, + TABLE_LIST *tables, + COND *cond); + +static handlerton *ndbcluster_hton; + +static handler *ndbcluster_create_handler(handlerton *hton, + TABLE_SHARE *table, MEM_ROOT *mem_root) { - return new (mem_root) ha_ndbcluster(table); + return new (mem_root) ha_ndbcluster(hton, table); } static uint ndbcluster_partition_flags() @@ -4201,7 +4209,7 @@ int ha_ndbcluster::start_stmt(THD *thd, thr_lock_type lock_type) Commit a transaction started in NDB */ -static int ndbcluster_commit(THD *thd, bool all) +static int ndbcluster_commit(handlerton *hton, THD *thd, bool all) { int res= 0; Thd_ndb *thd_ndb= get_thd_ndb(thd); @@ -4252,7 +4260,7 @@ static int ndbcluster_commit(THD *thd, bool all) Rollback a transaction started in NDB */ -static int ndbcluster_rollback(THD *thd, bool all) +static int ndbcluster_rollback(handlerton *hton, THD *thd, bool all) { int res= 0; Thd_ndb *thd_ndb= get_thd_ndb(thd); @@ -5552,8 +5560,8 @@ void ha_ndbcluster::get_auto_increment(ulonglong offset, ulonglong increment, HA_HAS_OWN_BINLOGGING | \ HA_HAS_RECORDS -ha_ndbcluster::ha_ndbcluster(TABLE_SHARE *table_arg): - handler(ndbcluster_hton, table_arg), +ha_ndbcluster::ha_ndbcluster(handlerton *hton, TABLE_SHARE *table_arg): + handler(hton, table_arg), m_active_trans(NULL), m_active_cursor(NULL), m_table(NULL), @@ -5816,7 +5824,7 @@ int ha_ndbcluster::check_ndb_connection(THD* thd) } -static int ndbcluster_close_connection(THD *thd) +static int ndbcluster_close_connection(handlerton *hton, THD *thd) { Thd_ndb *thd_ndb= get_thd_ndb(thd); DBUG_ENTER("ndbcluster_close_connection"); @@ -5833,8 +5841,10 @@ static int ndbcluster_close_connection(THD *thd) Try to discover one table from NDB */ -int ndbcluster_discover(THD* thd, const char *db, const char *name, - const void** frmblob, uint* frmlen) +int ndbcluster_discover(handlerton *hton, THD* thd, const char *db, + const char *name, + const void** frmblob, + uint* frmlen) { int error= 0; NdbError ndb_error; @@ -5914,7 +5924,8 @@ err: */ -int ndbcluster_table_exists_in_engine(THD* thd, const char *db, +int ndbcluster_table_exists_in_engine(handlerton *hton, THD* thd, + const char *db, const char *name) { Ndb* ndb; @@ -6014,7 +6025,7 @@ int ndbcluster_drop_database_impl(const char *path) DBUG_RETURN(ret); } -static void ndbcluster_drop_database(char *path) +static void ndbcluster_drop_database(handlerton *hton, char *path) { THD *thd= current_thd; DBUG_ENTER("ndbcluster_drop_database"); @@ -6175,7 +6186,9 @@ int ndbcluster_find_all_files(THD *thd) DBUG_RETURN(-(skipped + unhandled)); } -int ndbcluster_find_files(THD *thd,const char *db,const char *path, +int ndbcluster_find_files(handlerton *hton, THD *thd, + const char *db, + const char *path, const char *wild, bool dir, List<char> *files) { DBUG_ENTER("ndbcluster_find_files"); @@ -6285,7 +6298,7 @@ int ndbcluster_find_files(THD *thd,const char *db,const char *path, DBUG_PRINT("info", ("%s existed on disk", name)); // The .ndb file exists on disk, but it's not in list of tables in ndb // Verify that handler agrees table is gone. - if (ndbcluster_table_exists_in_engine(thd, db, file_name) == 0) + if (ndbcluster_table_exists_in_engine(hton, thd, db, file_name) == 0) { DBUG_PRINT("info", ("NDB says %s does not exists", file_name)); it.remove(); @@ -6539,7 +6552,7 @@ ndbcluster_init_error: DBUG_RETURN(TRUE); } -static int ndbcluster_end(ha_panic_function type) +static int ndbcluster_end(handlerton *hton, ha_panic_function type) { DBUG_ENTER("ndbcluster_end"); @@ -6623,7 +6636,7 @@ void ndbcluster_print_error(int error, const NdbOperation *error_op) share.db.length= 0; share.table_name.str= (char *) tab_name; share.table_name.length= strlen(tab_name); - ha_ndbcluster error_handler(&share); + ha_ndbcluster error_handler(ndbcluster_hton, &share); error_handler.print_error(error, MYF(0)); DBUG_VOID_RETURN; } @@ -9703,7 +9716,7 @@ err: Implements the SHOW NDB STATUS command. */ bool -ndbcluster_show_status(THD* thd, stat_print_fn *stat_print, +ndbcluster_show_status(handlerton *hton, THD* thd, stat_print_fn *stat_print, enum ha_stat_type stat_type) { char buf[IO_SIZE]; @@ -10167,7 +10180,7 @@ bool set_up_undofile(st_alter_tablespace *info, return false; } -int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info) +int ndbcluster_alter_tablespace(handlerton *hton, THD* thd, st_alter_tablespace *info) { DBUG_ENTER("ha_ndbcluster::alter_tablespace"); @@ -10428,7 +10441,9 @@ bool ha_ndbcluster::get_no_parts(const char *name, uint *no_parts) DBUG_RETURN(TRUE); } -static int ndbcluster_fill_files_table(THD *thd, TABLE_LIST *tables, +static int ndbcluster_fill_files_table(handlerton *hton, + THD *thd, + TABLE_LIST *tables, COND *cond) { TABLE* table= tables->table; diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h index 5cd5bb2c716..19ff513f9b1 100644 --- a/sql/ha_ndbcluster.h +++ b/sql/ha_ndbcluster.h @@ -627,7 +627,7 @@ class Thd_ndb class ha_ndbcluster: public handler { public: - ha_ndbcluster(TABLE_SHARE *table); + ha_ndbcluster(handlerton *hton, TABLE_SHARE *table); ~ha_ndbcluster(); int ha_initialise(); diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc index 3fc84ad1b66..5f5c8bcb221 100644 --- a/sql/ha_ndbcluster_binlog.cc +++ b/sql/ha_ndbcluster_binlog.cc @@ -506,7 +506,7 @@ ndbcluster_binlog_index_purge_file(THD *thd, const char *file) } static void -ndbcluster_binlog_log_query(THD *thd, enum_binlog_command binlog_command, +ndbcluster_binlog_log_query(handlerton *hton, THD *thd, enum_binlog_command binlog_command, const char *query, uint query_length, const char *db, const char *table_name) { @@ -637,7 +637,9 @@ static void ndbcluster_reset_slave(THD *thd) /* Initialize the binlog part of the ndb handlerton */ -static int ndbcluster_binlog_func(THD *thd, enum_binlog_func fn, void *arg) +static int ndbcluster_binlog_func(handlerton *hton, THD *thd, + enum_binlog_func fn, + void *arg) { switch(fn) { diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 8e704f34550..0da0094d92e 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -69,16 +69,17 @@ static PARTITION_SHARE *get_share(const char *table_name, TABLE * table); MODULE create/delete handler object ****************************************************************************/ -static handler *partition_create_handler(TABLE_SHARE *share, +static handler *partition_create_handler(handlerton *hton, + TABLE_SHARE *share, MEM_ROOT *mem_root); static uint partition_flags(); static uint alter_table_flags(uint flags); -handlerton *partition_hton; static int partition_initialize(void *p) { + handlerton *partition_hton; partition_hton= (handlerton *)p; partition_hton->state= SHOW_OPTION_YES; @@ -102,10 +103,11 @@ static int partition_initialize(void *p) New partition object */ -static handler *partition_create_handler(TABLE_SHARE *share, +static handler *partition_create_handler(handlerton *hton, + TABLE_SHARE *share, MEM_ROOT *mem_root) { - ha_partition *file= new (mem_root) ha_partition(share); + ha_partition *file= new (mem_root) ha_partition(hton, share); if (file && file->initialise_partition(mem_root)) { delete file; @@ -155,8 +157,8 @@ static uint alter_table_flags(uint flags __attribute__((unused))) NONE */ -ha_partition::ha_partition(TABLE_SHARE *share) - :handler(partition_hton, share), m_part_info(NULL), m_create_handler(FALSE), +ha_partition::ha_partition(handlerton *hton, TABLE_SHARE *share) + :handler(hton, share), m_part_info(NULL), m_create_handler(FALSE), m_is_sub_partitioned(0) { DBUG_ENTER("ha_partition::ha_partition(table)"); @@ -176,8 +178,8 @@ ha_partition::ha_partition(TABLE_SHARE *share) NONE */ -ha_partition::ha_partition(partition_info *part_info) - :handler(partition_hton, NULL), m_part_info(part_info), +ha_partition::ha_partition(handlerton *hton, partition_info *part_info) + :handler(hton, NULL), m_part_info(part_info), m_create_handler(TRUE), m_is_sub_partitioned(m_part_info->is_sub_partitioned()) diff --git a/sql/ha_partition.h b/sql/ha_partition.h index 97086d7b632..b66db205549 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -149,8 +149,8 @@ public: partition handler. ------------------------------------------------------------------------- */ - ha_partition(TABLE_SHARE * table); - ha_partition(partition_info * part_info); + ha_partition(handlerton *hton, TABLE_SHARE * table); + ha_partition(handlerton *hton, partition_info * part_info); ~ha_partition(); /* A partition handler has no characteristics in itself. It only inherits diff --git a/sql/handler.cc b/sql/handler.cc index 7848552f3de..ccf1a1ef8d9 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -170,7 +170,7 @@ const char *ha_get_storage_engine(enum legacy_db_type db_type) static handler *create_default(TABLE_SHARE *table, MEM_ROOT *mem_root) { handlerton *hton= ha_default_handlerton(current_thd); - return (hton && hton->create) ? hton->create(table, mem_root) : NULL; + return (hton && hton->create) ? hton->create(hton, table, mem_root) : NULL; } @@ -232,7 +232,7 @@ handler *get_new_handler(TABLE_SHARE *share, MEM_ROOT *alloc, if (db_type && db_type->state == SHOW_OPTION_YES && db_type->create) { - if ((file= db_type->create(share, alloc))) + if ((file= db_type->create(db_type, share, alloc))) file->init(); DBUG_RETURN(file); } @@ -251,7 +251,7 @@ handler *get_ha_partition(partition_info *part_info) { ha_partition *partition; DBUG_ENTER("get_ha_partition"); - if ((partition= new ha_partition(part_info))) + if ((partition= new ha_partition(partition_hton, part_info))) { if (partition->initialise_partition(current_thd->mem_root)) { @@ -376,7 +376,7 @@ int ha_finalize_handlerton(st_plugin_int *plugin) case SHOW_OPTION_YES: if (installed_htons[hton->db_type] == hton) installed_htons[hton->db_type]= NULL; - if (hton->panic && hton->panic(HA_PANIC_CLOSE)) + if (hton->panic && hton->panic(hton, HA_PANIC_CLOSE)) DBUG_RETURN(1); break; }; @@ -465,6 +465,26 @@ int ha_initialize_handlerton(st_plugin_int *plugin) hton->state= SHOW_OPTION_DISABLED; break; } + + /* + This is entirely for legacy. We will create a new "disk based" hton and a + "memory" hton which will be configurable longterm. We should be able to + remove partition and myisammrg. + */ + switch (hton->db_type) { + case DB_TYPE_HEAP: + heap_hton= hton; + break; + case DB_TYPE_MYISAM: + myisam_hton= hton; + break; + case DB_TYPE_PARTITION_DB: + partition_hton= hton; + break; + default: + break; + }; + DBUG_RETURN(0); err: DBUG_RETURN(1); @@ -498,7 +518,7 @@ static my_bool panic_handlerton(THD *unused1, st_plugin_int *plugin, void *arg) { handlerton *hton= (handlerton *)plugin->data; if (hton->state == SHOW_OPTION_YES && hton->panic) - ((int*)arg)[0]|= hton->panic((enum ha_panic_function)((int*)arg)[1]); + ((int*)arg)[0]|= hton->panic(hton, (enum ha_panic_function)((int*)arg)[1]); return FALSE; } @@ -520,7 +540,7 @@ static my_bool dropdb_handlerton(THD *unused1, st_plugin_int *plugin, { handlerton *hton= (handlerton *)plugin->data; if (hton->state == SHOW_OPTION_YES && hton->drop_database) - hton->drop_database((char *)path); + hton->drop_database(hton, (char *)path); return FALSE; } @@ -541,7 +561,7 @@ static my_bool closecon_handlerton(THD *thd, st_plugin_int *plugin, */ if (hton->state == SHOW_OPTION_YES && hton->close_connection && thd->ha_data[hton->slot]) - hton->close_connection(thd); + hton->close_connection(hton, thd); return FALSE; } @@ -617,7 +637,7 @@ int ha_prepare(THD *thd) statistic_increment(thd->status_var.ha_prepare_count,&LOCK_status); if ((*ht)->prepare) { - if ((err= (*(*ht)->prepare)(thd, all))) + if ((err= (*(*ht)->prepare)(*ht, thd, all))) { my_error(ER_ERROR_DURING_COMMIT, MYF(0), err); ha_rollback_trans(thd, all); @@ -691,7 +711,7 @@ int ha_commit_trans(THD *thd, bool all) for (; *ht && !error; ht++) { int err; - if ((err= (*(*ht)->prepare)(thd, all))) + if ((err= (*(*ht)->prepare)(*ht, thd, all))) { my_error(ER_ERROR_DURING_COMMIT, MYF(0), err); error= 1; @@ -738,7 +758,7 @@ int ha_commit_one_phase(THD *thd, bool all) for (ht=trans->ht; *ht; ht++) { int err; - if ((err= (*(*ht)->commit)(thd, all))) + if ((err= (*(*ht)->commit)(*ht, thd, all))) { my_error(ER_ERROR_DURING_COMMIT, MYF(0), err); error=1; @@ -794,7 +814,7 @@ int ha_rollback_trans(THD *thd, bool all) for (handlerton **ht=trans->ht; *ht; ht++) { int err; - if ((err= (*(*ht)->rollback)(thd, all))) + if ((err= (*(*ht)->rollback)(*ht, thd, all))) { // cannot happen my_error(ER_ERROR_DURING_ROLLBACK, MYF(0), err); error=1; @@ -871,7 +891,7 @@ static my_bool xacommit_handlerton(THD *unused1, st_plugin_int *plugin, handlerton *hton= (handlerton *)plugin->data; if (hton->state == SHOW_OPTION_YES && hton->recover) { - hton->commit_by_xid(((struct xahton_st *)arg)->xid); + hton->commit_by_xid(hton, ((struct xahton_st *)arg)->xid); ((struct xahton_st *)arg)->result= 0; } return FALSE; @@ -883,7 +903,7 @@ static my_bool xarollback_handlerton(THD *unused1, st_plugin_int *plugin, handlerton *hton= (handlerton *)plugin->data; if (hton->state == SHOW_OPTION_YES && hton->recover) { - hton->rollback_by_xid(((struct xahton_st *)arg)->xid); + hton->rollback_by_xid(hton, ((struct xahton_st *)arg)->xid); ((struct xahton_st *)arg)->result= 0; } return FALSE; @@ -993,7 +1013,7 @@ static my_bool xarecover_handlerton(THD *unused, st_plugin_int *plugin, if (hton->state == SHOW_OPTION_YES && hton->recover) { - while ((got= hton->recover(info->list, info->len)) > 0 ) + while ((got= hton->recover(hton, info->list, info->len)) > 0 ) { sql_print_information("Found %d prepared transaction(s) in %s", got, hton2plugin[hton->slot]->name.str); @@ -1024,7 +1044,7 @@ static my_bool xarecover_handlerton(THD *unused, st_plugin_int *plugin, char buf[XIDDATASIZE*4+6]; // see xid_to_str sql_print_information("commit xid %s", xid_to_str(buf, info->list+i)); #endif - hton->commit_by_xid(info->list+i); + hton->commit_by_xid(hton, info->list+i); } else { @@ -1033,7 +1053,7 @@ static my_bool xarecover_handlerton(THD *unused, st_plugin_int *plugin, sql_print_information("rollback xid %s", xid_to_str(buf, info->list+i)); #endif - hton->rollback_by_xid(info->list+i); + hton->rollback_by_xid(hton, info->list+i); } } if (got < info->len) @@ -1179,7 +1199,7 @@ static my_bool release_temporary_latches(THD *thd, st_plugin_int *plugin, handlerton *hton= (handlerton *)plugin->data; if (hton->state == SHOW_OPTION_YES && hton->release_temporary_latches) - hton->release_temporary_latches(thd); + hton->release_temporary_latches(hton, thd); return FALSE; } @@ -1212,7 +1232,7 @@ int ha_rollback_to_savepoint(THD *thd, SAVEPOINT *sv) { int err; DBUG_ASSERT((*ht)->savepoint_set != 0); - if ((err= (*(*ht)->savepoint_rollback)(thd, (byte *)(sv+1)+(*ht)->savepoint_offset))) + if ((err= (*(*ht)->savepoint_rollback)(*ht, thd, (byte *)(sv+1)+(*ht)->savepoint_offset))) { // cannot happen my_error(ER_ERROR_DURING_ROLLBACK, MYF(0), err); error=1; @@ -1228,7 +1248,7 @@ int ha_rollback_to_savepoint(THD *thd, SAVEPOINT *sv) for (; *ht ; ht++) { int err; - if ((err= (*(*ht)->rollback)(thd, !thd->in_sub_stmt))) + if ((err= (*(*ht)->rollback)(*ht, thd, !thd->in_sub_stmt))) { // cannot happen my_error(ER_ERROR_DURING_ROLLBACK, MYF(0), err); error=1; @@ -1262,7 +1282,7 @@ int ha_savepoint(THD *thd, SAVEPOINT *sv) error=1; break; } - if ((err= (*(*ht)->savepoint_set)(thd, (byte *)(sv+1)+(*ht)->savepoint_offset))) + if ((err= (*(*ht)->savepoint_set)(*ht, thd, (byte *)(sv+1)+(*ht)->savepoint_offset))) { // cannot happen my_error(ER_GET_ERRNO, MYF(0), err); error=1; @@ -1288,7 +1308,9 @@ int ha_release_savepoint(THD *thd, SAVEPOINT *sv) int err; if (!(*ht)->savepoint_release) continue; - if ((err= (*(*ht)->savepoint_release)(thd, (byte *)(sv+1)+(*ht)->savepoint_offset))) + if ((err= (*(*ht)->savepoint_release)(*ht, thd, + (byte *)(sv+1)+ + (*ht)->savepoint_offset))) { // cannot happen my_error(ER_GET_ERRNO, MYF(0), err); error=1; @@ -1305,7 +1327,7 @@ static my_bool snapshot_handlerton(THD *thd, st_plugin_int *plugin, if (hton->state == SHOW_OPTION_YES && hton->start_consistent_snapshot) { - hton->start_consistent_snapshot(thd); + hton->start_consistent_snapshot(hton, thd); *((bool *)arg)= false; } return FALSE; @@ -1333,7 +1355,8 @@ static my_bool flush_handlerton(THD *thd, st_plugin_int *plugin, void *arg) { handlerton *hton= (handlerton *)plugin->data; - if (hton->state == SHOW_OPTION_YES && hton->flush_logs && hton->flush_logs()) + if (hton->state == SHOW_OPTION_YES && hton->flush_logs && + hton->flush_logs(hton)) return TRUE; return FALSE; } @@ -1350,7 +1373,7 @@ bool ha_flush_logs(handlerton *db_type) else { if (db_type->state != SHOW_OPTION_YES || - (db_type->flush_logs && db_type->flush_logs())) + (db_type->flush_logs && db_type->flush_logs(db_type))) return TRUE; } return FALSE; @@ -2765,7 +2788,9 @@ static my_bool discover_handlerton(THD *thd, st_plugin_int *plugin, st_discover_args *vargs= (st_discover_args *)arg; handlerton *hton= (handlerton *)plugin->data; if (hton->state == SHOW_OPTION_YES && hton->discover && - (!(hton->discover(thd, vargs->db, vargs->name, vargs->frmblob, vargs->frmlen)))) + (!(hton->discover(hton, thd, vargs->db, vargs->name, + vargs->frmblob, + vargs->frmlen)))) return TRUE; return FALSE; @@ -2814,7 +2839,7 @@ static my_bool find_files_handlerton(THD *thd, st_plugin_int *plugin, if (hton->state == SHOW_OPTION_YES && hton->find_files) - if (hton->find_files(thd, vargs->db, vargs->path, vargs->wild, + if (hton->find_files(hton, thd, vargs->db, vargs->path, vargs->wild, vargs->dir, vargs->files)) return TRUE; @@ -2861,7 +2886,7 @@ static my_bool table_exists_in_engine_handlerton(THD *thd, st_plugin_int *plugin handlerton *hton= (handlerton *)plugin->data; if (hton->state == SHOW_OPTION_YES && hton->table_exists_in_engine) - if ((hton->table_exists_in_engine(thd, vargs->db, vargs->name)) == 1) + if ((hton->table_exists_in_engine(hton, thd, vargs->db, vargs->name)) == 1) return TRUE; return FALSE; @@ -2930,7 +2955,7 @@ static my_bool binlog_func_foreach(THD *thd, binlog_func_st *bfn) uint i= 0, sz= hton_list.sz; while(i < sz) - hton_list.hton[i++]->binlog_func(thd, bfn->fn, bfn->arg); + hton_list.hton[i++]->binlog_func(hton, thd, bfn->fn, bfn->arg); return FALSE; } @@ -2977,12 +3002,12 @@ struct binlog_log_query_st }; static my_bool binlog_log_query_handlerton2(THD *thd, - const handlerton *hton, + handlerton *hton, void *args) { struct binlog_log_query_st *b= (struct binlog_log_query_st*)args; if (hton->state == SHOW_OPTION_YES && hton->binlog_log_query) - hton->binlog_log_query(thd, + hton->binlog_log_query(hton, thd, b->binlog_command, b->query, b->query_length, @@ -2995,10 +3020,10 @@ static my_bool binlog_log_query_handlerton(THD *thd, st_plugin_int *plugin, void *args) { - return binlog_log_query_handlerton2(thd, (const handlerton *)plugin->data, args); + return binlog_log_query_handlerton2(thd, (handlerton *)plugin->data, args); } -void ha_binlog_log_query(THD *thd, const handlerton *hton, +void ha_binlog_log_query(THD *thd, handlerton *hton, enum_binlog_command binlog_command, const char *query, uint query_length, const char *db, const char *table_name) @@ -3296,7 +3321,7 @@ static my_bool exts_handlerton(THD *unused, st_plugin_int *plugin, handlerton *hton= (handlerton *)plugin->data; handler *file; if (hton->state == SHOW_OPTION_YES && hton->create && - (file= hton->create((TABLE_SHARE*) 0, current_thd->mem_root))) + (file= hton->create(hton, (TABLE_SHARE*) 0, current_thd->mem_root))) { List_iterator_fast<char> it(*found_exts); const char **ext, *old_ext; @@ -3371,7 +3396,7 @@ static my_bool showstat_handlerton(THD *thd, st_plugin_int *plugin, enum ha_stat_type stat= *(enum ha_stat_type *) arg; handlerton *hton= (handlerton *)plugin->data; if (hton->state == SHOW_OPTION_YES && hton->show_status && - hton->show_status(thd, stat_print, stat)) + hton->show_status(hton, thd, stat_print, stat)) return TRUE; return FALSE; } @@ -3405,7 +3430,7 @@ bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat) } else result= db_type->show_status && - db_type->show_status(thd, stat_print, stat) ? 1 : 0; + db_type->show_status(db_type, thd, stat_print, stat) ? 1 : 0; } if (!result) @@ -3726,7 +3751,7 @@ int example_of_iterator_using_for_logs_cleanup(handlerton *hton) if (!hton->create_iterator) return 1; /* iterator creator is not supported */ - if ((*hton->create_iterator)(HA_TRANSACTLOG_ITERATOR, &iterator) != + if ((*hton->create_iterator)(hton, HA_TRANSACTLOG_ITERATOR, &iterator) != HA_ITERATOR_OK) { /* error during creation of log iterator or iterator is not supported */ diff --git a/sql/handler.h b/sql/handler.h index 3c237149386..e0827fec5c8 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -449,7 +449,7 @@ class st_alter_tablespace : public Sql_alloc ulonglong autoextend_size; ulonglong max_size; uint nodegroup_id; - const handlerton *storage_engine; + handlerton *storage_engine; bool wait_until_completed; const char *ts_comment; enum tablespace_access_mode ts_access_mode; @@ -605,18 +605,18 @@ struct handlerton this storage area - set it to something, so that MySQL would know this storage engine was accessed in this connection */ - int (*close_connection)(THD *thd); + int (*close_connection)(handlerton *hton, THD *thd); /* sv points to an uninitialized storage area of requested size (see savepoint_offset description) */ - int (*savepoint_set)(THD *thd, void *sv); + int (*savepoint_set)(handlerton *hton, THD *thd, void *sv); /* sv points to a storage area, that was earlier passed to the savepoint_set call */ - int (*savepoint_rollback)(THD *thd, void *sv); - int (*savepoint_release)(THD *thd, void *sv); + int (*savepoint_rollback)(handlerton *hton, THD *thd, void *sv); + int (*savepoint_release)(handlerton *hton, THD *thd, void *sv); /* 'all' is true if it's a real commit, that makes persistent changes 'all' is false if it's not in fact a commit but an end of the @@ -624,25 +624,25 @@ struct handlerton NOTE 'all' is also false in auto-commit mode where 'end of statement' and 'real commit' mean the same event. */ - int (*commit)(THD *thd, bool all); - int (*rollback)(THD *thd, bool all); - int (*prepare)(THD *thd, bool all); - int (*recover)(XID *xid_list, uint len); - int (*commit_by_xid)(XID *xid); - int (*rollback_by_xid)(XID *xid); - void *(*create_cursor_read_view)(THD *thd); - void (*set_cursor_read_view)(THD *thd, void *read_view); - void (*close_cursor_read_view)(THD *thd, void *read_view); - handler *(*create)(TABLE_SHARE *table, MEM_ROOT *mem_root); - void (*drop_database)(char* path); - int (*panic)(enum ha_panic_function flag); - int (*start_consistent_snapshot)(THD *thd); - bool (*flush_logs)(); - bool (*show_status)(THD *thd, stat_print_fn *print, enum ha_stat_type stat); + int (*commit)(handlerton *hton, THD *thd, bool all); + int (*rollback)(handlerton *hton, THD *thd, bool all); + int (*prepare)(handlerton *hton, THD *thd, bool all); + int (*recover)(handlerton *hton, XID *xid_list, uint len); + int (*commit_by_xid)(handlerton *hton, XID *xid); + int (*rollback_by_xid)(handlerton *hton, XID *xid); + void *(*create_cursor_read_view)(handlerton *hton, THD *thd); + void (*set_cursor_read_view)(handlerton *hton, THD *thd, void *read_view); + void (*close_cursor_read_view)(handlerton *hton, THD *thd, void *read_view); + handler *(*create)(handlerton *hton, TABLE_SHARE *table, MEM_ROOT *mem_root); + void (*drop_database)(handlerton *hton, char* path); + int (*panic)(handlerton *hton, enum ha_panic_function flag); + int (*start_consistent_snapshot)(handlerton *hton, THD *thd); + bool (*flush_logs)(handlerton *hton); + bool (*show_status)(handlerton *hton, THD *thd, stat_print_fn *print, enum ha_stat_type stat); uint (*partition_flags)(); uint (*alter_table_flags)(uint flags); - int (*alter_tablespace)(THD *thd, st_alter_tablespace *ts_info); - int (*fill_files_table)(THD *thd, + int (*alter_tablespace)(handlerton *hton, THD *thd, st_alter_tablespace *ts_info); + int (*fill_files_table)(handlerton *hton, THD *thd, struct st_table_list *tables, class Item *cond); uint32 flags; /* global handler flags */ @@ -650,11 +650,12 @@ struct handlerton Those handlerton functions below are properly initialized at handler init. */ - int (*binlog_func)(THD *thd, enum_binlog_func fn, void *arg); - void (*binlog_log_query)(THD *thd, enum_binlog_command binlog_command, + int (*binlog_func)(handlerton *hton, THD *thd, enum_binlog_func fn, void *arg); + void (*binlog_log_query)(handlerton *hton, THD *thd, + enum_binlog_command binlog_command, const char *query, uint query_length, const char *db, const char *table_name); - int (*release_temporary_latches)(THD *thd); + int (*release_temporary_latches)(handlerton *hton, THD *thd); /* Get log status. @@ -663,20 +664,24 @@ struct handlerton (see example of implementation in handler.cc, TRANS_LOG_MGM_EXAMPLE_CODE) */ - enum log_status (*get_log_status)(char *log); + enum log_status (*get_log_status)(handlerton *hton, char *log); /* Iterators creator. Presence of the pointer should be checked before using */ enum handler_create_iterator_result - (*create_iterator)(enum handler_iterator_type type, + (*create_iterator)(handlerton *hton, enum handler_iterator_type type, struct handler_iterator *fill_this_in); - int (*discover)(THD* thd, const char *db, const char *name, - const void** frmblob, uint* frmlen); - int (*find_files)(THD *thd,const char *db,const char *path, + int (*discover)(handlerton *hton, THD* thd, const char *db, + const char *name, + const void** frmblob, + uint* frmlen); + int (*find_files)(handlerton *hton, THD *thd, + const char *db, + const char *path, const char *wild, bool dir, List<char> *files); - int (*table_exists_in_engine)(THD* thd, const char *db, + int (*table_exists_in_engine)(handlerton *hton, THD* thd, const char *db, const char *name); }; @@ -691,6 +696,7 @@ struct handlerton #define HTON_NOT_USER_SELECTABLE (1 << 5) #define HTON_TEMPORARY_NOT_SUPPORTED (1 << 6) //Having temporary tables not supported #define HTON_SUPPORT_LOG_TABLES (1 << 7) //Engine supports log tables +#define HTON_NO_PARTITION (1 << 8) //You can not partition these tables typedef struct st_thd_trans { @@ -893,7 +899,7 @@ class handler :public Sql_alloc virtual void start_bulk_insert(ha_rows rows) {} virtual int end_bulk_insert() {return 0; } public: - const handlerton *ht; /* storage engine of this handler */ + handlerton *ht; /* storage engine of this handler */ byte *ref; /* Pointer to current row */ byte *dup_ref; /* Pointer to duplicate row */ @@ -943,7 +949,7 @@ public: */ Discrete_interval auto_inc_interval_for_cur_row; - handler(const handlerton *ht_arg, TABLE_SHARE *share_arg) + handler(handlerton *ht_arg, TABLE_SHARE *share_arg) :table_share(share_arg), estimation_rows_to_insert(0), ht(ht_arg), ref(0), key_used_on_scan(MAX_KEY), active_index(MAX_KEY), ref_length(sizeof(my_off_t)), @@ -1716,7 +1722,7 @@ void trans_register_ha(THD *thd, bool all, handlerton *ht); int ha_reset_logs(THD *thd); int ha_binlog_index_purge_file(THD *thd, const char *file); void ha_reset_slave(THD *thd); -void ha_binlog_log_query(THD *thd, const handlerton *db_type, +void ha_binlog_log_query(THD *thd, handlerton *db_type, enum_binlog_command binlog_command, const char *query, uint query_length, const char *db, const char *table_name); diff --git a/sql/log.cc b/sql/log.cc index 9c2efb04a44..05758fd6e7d 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -46,13 +46,13 @@ static Muted_query_log_event invisible_commit; static bool test_if_number(const char *str, long *res, bool allow_wildcards); -static int binlog_init(); -static int binlog_close_connection(THD *thd); -static int binlog_savepoint_set(THD *thd, void *sv); -static int binlog_savepoint_rollback(THD *thd, void *sv); -static int binlog_commit(THD *thd, bool all); -static int binlog_rollback(THD *thd, bool all); -static int binlog_prepare(THD *thd, bool all); +static int binlog_init(void *p); +static int binlog_close_connection(handlerton *hton, THD *thd); +static int binlog_savepoint_set(handlerton *hton, THD *thd, void *sv); +static int binlog_savepoint_rollback(handlerton *hton, THD *thd, void *sv); +static int binlog_commit(handlerton *hton, THD *thd, bool all); +static int binlog_rollback(handlerton *hton, THD *thd, bool all); +static int binlog_prepare(handlerton *hton, THD *thd, bool all); sql_print_message_func sql_print_message_handlers[3] = { @@ -1171,7 +1171,7 @@ int binlog_init(void *p) return 0; } -static int binlog_close_connection(THD *thd) +static int binlog_close_connection(handlerton *hton, THD *thd) { binlog_trx_data *const trx_data= (binlog_trx_data*) thd->ha_data[binlog_hton->slot]; @@ -1184,7 +1184,8 @@ static int binlog_close_connection(THD *thd) } static int -binlog_end_trans(THD *thd, binlog_trx_data *trx_data, Log_event *end_ev) +binlog_end_trans(THD *thd, binlog_trx_data *trx_data, + Log_event *end_ev) { DBUG_ENTER("binlog_end_trans"); int error=0; @@ -1238,7 +1239,7 @@ binlog_end_trans(THD *thd, binlog_trx_data *trx_data, Log_event *end_ev) DBUG_RETURN(error); } -static int binlog_prepare(THD *thd, bool all) +static int binlog_prepare(handlerton *hton, THD *thd, bool all) { /* do nothing. @@ -1249,7 +1250,7 @@ static int binlog_prepare(THD *thd, bool all) return 0; } -static int binlog_commit(THD *thd, bool all) +static int binlog_commit(handlerton *hton, THD *thd, bool all) { DBUG_ENTER("binlog_commit"); binlog_trx_data *const trx_data= @@ -1273,7 +1274,7 @@ static int binlog_commit(THD *thd, bool all) DBUG_RETURN(binlog_end_trans(thd, trx_data, &invisible_commit)); } -static int binlog_rollback(THD *thd, bool all) +static int binlog_rollback(handlerton *hton, THD *thd, bool all) { DBUG_ENTER("binlog_rollback"); int error=0; @@ -1326,7 +1327,7 @@ static int binlog_rollback(THD *thd, bool all) that case there is no need to have it in the binlog). */ -static int binlog_savepoint_set(THD *thd, void *sv) +static int binlog_savepoint_set(handlerton *hton, THD *thd, void *sv) { DBUG_ENTER("binlog_savepoint_set"); binlog_trx_data *const trx_data= @@ -1342,7 +1343,7 @@ static int binlog_savepoint_set(THD *thd, void *sv) DBUG_RETURN(error); } -static int binlog_savepoint_rollback(THD *thd, void *sv) +static int binlog_savepoint_rollback(handlerton *hton, THD *thd, void *sv) { DBUG_ENTER("binlog_savepoint_rollback"); binlog_trx_data *const trx_data= diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index c6f5ff9c3fe..95f194dc7ac 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -1637,19 +1637,7 @@ extern SHOW_COMP_OPTION have_ndbcluster; extern SHOW_COMP_OPTION have_partition_db; extern SHOW_COMP_OPTION have_merge_db; -#ifdef WITH_CSV_STORAGE_ENGINE -extern handlerton *tina_hton; -#endif -#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE -extern handlerton *ndbcluster_hton; -#endif -#ifdef WITH_PARTITION_STORAGE_ENGINE extern handlerton *partition_hton; -#endif -#ifdef WITH_MYISAMMRG_STORAGE_ENGINE -extern handlerton *myisammrg_hton; -#endif - extern handlerton *myisam_hton; extern handlerton *heap_hton; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index a3844ea8fc0..ba7db6aaf82 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -354,6 +354,14 @@ my_bool opt_safe_user_create = 0, opt_no_mix_types = 0; my_bool opt_show_slave_auth_info, opt_sql_bin_update = 0; my_bool opt_log_slave_updates= 0; my_bool opt_innodb; + +/* + Legacy global handlerton. These will be removed (please do not add more). +*/ +handlerton *heap_hton; +handlerton *myisam_hton; +handlerton *partition_hton; + #ifdef WITH_INNOBASE_STORAGE_ENGINE extern ulong innobase_fast_shutdown; extern ulong innobase_large_page_size; diff --git a/sql/partition_info.cc b/sql/partition_info.cc index 3e8ad9bb78b..b3c7c1b80e7 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -443,11 +443,9 @@ bool partition_info::check_engine_mix(handlerton **engine_array, uint no_parts) DBUG_RETURN(TRUE); } } while (++i < no_parts); - if (engine_array[0] == myisammrg_hton || - engine_array[0] == tina_hton) + if (engine_array[0]->flags & HTON_NO_PARTITION) { - my_error(ER_PARTITION_MERGE_ERROR, MYF(0), - engine_array[0] == myisammrg_hton ? "MyISAM Merge" : "CSV"); + my_error(ER_PARTITION_MERGE_ERROR, MYF(0)); DBUG_RETURN(TRUE); } DBUG_RETURN(FALSE); diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index c90e771fd40..e465e5881d6 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -5960,9 +5960,9 @@ ER_EVENT_SET_VAR_ERROR eng "Error during starting/stopping of the scheduler. Error code %u" ger "Fehler während des Startens oder Anhalten des Schedulers. Fehlercode %u" ER_PARTITION_MERGE_ERROR - eng "%s handler cannot be used in partitioned tables" - ger "%s-Handler kann in partitionierten Tabellen nicht verwendet werden" - swe "%s kan inte användas i en partitionerad tabell" + eng "Engine cannot be used in partitioned tables" + ger "Engine kann in partitionierten Tabellen nicht verwendet werden" + swe "Engine inte användas i en partitionerad tabell" ER_CANT_ACTIVATE_LOG eng "Cannot activate '%-.64s' log" ger "Kann Logdatei '%-.64s' nicht aktivieren" diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index e0831b0f8ee..ee3b8aa79fe 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -2389,7 +2389,7 @@ Query_cache::register_tables_from_list(TABLE_LIST *tables_used, tables_used->engine_data)) DBUG_RETURN(0); - if (tables_used->table->s->db_type == myisammrg_hton) + if (tables_used->table->s->db_type->db_type == DB_TYPE_MRG_MYISAM) { ha_myisammrg *handler = (ha_myisammrg *) tables_used->table->file; MYRG_INFO *file = handler->myrg_info(); @@ -3013,7 +3013,7 @@ static TABLE_COUNTER_TYPE process_and_count_tables(TABLE_LIST *tables_used, "other non-cacheable table(s)")); DBUG_RETURN(0); } - if (tables_used->table->s->db_type == myisammrg_hton) + if (tables_used->table->s->db_type->db_type == DB_TYPE_MRG_MYISAM) { ha_myisammrg *handler = (ha_myisammrg *)tables_used->table->file; MYRG_INFO *file = handler->myrg_info(); diff --git a/sql/sql_cursor.cc b/sql/sql_cursor.cc index 82ee8d72d33..a9ad35e7f9b 100644 --- a/sql/sql_cursor.cc +++ b/sql/sql_cursor.cc @@ -45,7 +45,7 @@ class Sensitive_cursor: public Server_side_cursor query_id_t query_id; struct Engine_info { - const handlerton *ht; + handlerton *ht; void *read_view; }; Engine_info ht_info[MAX_HA]; @@ -318,12 +318,12 @@ Sensitive_cursor::post_open(THD *thd) info= &ht_info[0]; for (handlerton **pht= thd->transaction.stmt.ht; *pht; pht++) { - const handlerton *ht= *pht; + handlerton *ht= *pht; close_at_commit|= test(ht->flags & HTON_CLOSE_CURSORS_AT_COMMIT); if (ht->create_cursor_read_view) { info->ht= ht; - info->read_view= (ht->create_cursor_read_view)(thd); + info->read_view= (ht->create_cursor_read_view)(ht, thd); ++info; } } @@ -433,7 +433,7 @@ Sensitive_cursor::fetch(ulong num_rows) thd->set_n_backup_active_arena(this, &backup_arena); for (info= ht_info; info->read_view ; info++) - (info->ht->set_cursor_read_view)(thd, info->read_view); + (info->ht->set_cursor_read_view)(info->htthd, info->read_view); join->fetch_limit+= num_rows; @@ -454,7 +454,7 @@ Sensitive_cursor::fetch(ulong num_rows) reset_thd(thd); for (info= ht_info; info->read_view; info++) - (info->ht->set_cursor_read_view)(thd, 0); + (info->ht->set_cursor_read_view)(info->ht, thd, 0); if (error == NESTED_LOOP_CURSOR_LIMIT) { @@ -487,7 +487,7 @@ Sensitive_cursor::close() for (Engine_info *info= ht_info; info->read_view; info++) { - (info->ht->close_cursor_read_view)(thd, info->read_view); + (info->ht->close_cursor_read_view)(info->ht, thd, info->read_view); info->read_view= 0; info->ht= 0; } diff --git a/sql/sql_show.cc b/sql/sql_show.cc index ce7832569fe..45865adddcd 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -4999,7 +4999,7 @@ static my_bool run_hton_fill_schema_files(THD *thd, st_plugin_int *plugin, (run_hton_fill_schema_files_args *) arg; handlerton *hton= (handlerton *)plugin->data; if(hton->fill_files_table && hton->state == SHOW_OPTION_YES) - hton->fill_files_table(thd, args->tables, args->cond); + hton->fill_files_table(hton, thd, args->tables, args->cond); return false; } diff --git a/sql/sql_tablespace.cc b/sql/sql_tablespace.cc index 13dfb491af4..470fa5bc862 100644 --- a/sql/sql_tablespace.cc +++ b/sql/sql_tablespace.cc @@ -21,7 +21,7 @@ int mysql_alter_tablespace(THD *thd, st_alter_tablespace *ts_info) { int error= HA_ADMIN_NOT_IMPLEMENTED; - const handlerton *hton= ts_info->storage_engine; + handlerton *hton= ts_info->storage_engine; DBUG_ENTER("mysql_alter_tablespace"); /* @@ -42,7 +42,7 @@ int mysql_alter_tablespace(THD *thd, st_alter_tablespace *ts_info) if (hton->alter_tablespace) { - if ((error= hton->alter_tablespace(thd, ts_info))) + if ((error= hton->alter_tablespace(hton, thd, ts_info))) { if (error == HA_ADMIN_NOT_IMPLEMENTED) { |