Commit b93473aa authored by unknown's avatar unknown

This removes the passing of global hton to engine instance.


sql/ha_ndbcluster.cc:
  Removed global hton
sql/ha_ndbcluster.h:
  Removed global hton need
sql/ha_partition.cc:
  Removed global hton
sql/ha_partition.h:
  Removed global hton
sql/handler.cc:
  Removed global hton
sql/handler.h:
  Removed global hton
storage/archive/ha_archive.cc:
  Removed global hton
storage/archive/ha_archive.h:
  Global hton removed
storage/blackhole/ha_blackhole.cc:
  Global removed hton
storage/blackhole/ha_blackhole.h:
  Global hton removal
storage/csv/ha_tina.cc:
  Global hton removal
storage/csv/ha_tina.h:
  Removed global removed
storage/example/ha_example.cc:
  Global removed hton
storage/example/ha_example.h:
  Global removed hton
storage/federated/ha_federated.cc:
  Global removed hton
storage/federated/ha_federated.h:
  Global removed hton
storage/heap/ha_heap.cc:
  Global removed hton
storage/heap/ha_heap.h:
  Global removed hton
storage/innobase/handler/ha_innodb.cc:
  Global removed hton
storage/innobase/handler/ha_innodb.h:
  Removed global hton
storage/myisam/ha_myisam.cc:
  Globally removed hton
storage/myisam/ha_myisam.h:
  Globally removed hton
storage/myisammrg/ha_myisammrg.cc:
  Globally removed hton
storage/myisammrg/ha_myisammrg.h:
  Globaly removed hton
parent 1c5ceab7
......@@ -82,10 +82,11 @@ 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 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()
......@@ -5552,8 +5553,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),
......@@ -6623,7 +6624,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;
}
......
......@@ -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();
......
......@@ -69,7 +69,8 @@ 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);
......@@ -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())
......
......@@ -149,8 +149,8 @@ class ha_partition :public handler
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
......
......@@ -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))
{
......@@ -3296,7 +3296,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;
......
......@@ -633,7 +633,7 @@ struct handlerton
void *(*create_cursor_read_view)();
void (*set_cursor_read_view)(void *);
void (*close_cursor_read_view)(void *);
handler *(*create)(TABLE_SHARE *table, MEM_ROOT *mem_root);
handler *(*create)(handlerton *hton, 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);
......
......@@ -139,7 +139,9 @@ static HASH archive_open_tables;
#define ARCHIVE_CHECK_HEADER 254 // The number we use to determine corruption
/* Static declarations for handerton */
static handler *archive_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root);
static handler *archive_create_handler(handlerton *hton,
TABLE_SHARE *table,
MEM_ROOT *mem_root);
/*
Number of rows that will force a bulk insert.
*/
......@@ -147,9 +149,11 @@ static handler *archive_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root);
handlerton *archive_hton;
static handler *archive_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root)
static handler *archive_create_handler(handlerton *hton,
TABLE_SHARE *table,
MEM_ROOT *mem_root)
{
return new (mem_root) ha_archive(table);
return new (mem_root) ha_archive(hton, table);
}
/*
......@@ -231,8 +235,8 @@ int archive_db_end(ha_panic_function type)
return archive_db_done(NULL);
}
ha_archive::ha_archive(TABLE_SHARE *table_arg)
:handler(archive_hton, table_arg), delayed_insert(0), bulk_insert(0)
ha_archive::ha_archive(handlerton *hton, TABLE_SHARE *table_arg)
:handler(hton, table_arg), delayed_insert(0), bulk_insert(0)
{
/* Set our original buffer from pre-allocated memory */
buffer.set((char *)byte_buffer, IO_SIZE, system_charset_info);
......
......@@ -67,7 +67,7 @@ class ha_archive: public handler
uint current_k_offset;
public:
ha_archive(TABLE_SHARE *table_arg);
ha_archive(handlerton *hton, TABLE_SHARE *table_arg);
~ha_archive()
{
}
......
......@@ -25,10 +25,11 @@
/* Static declarations for handlerton */
handlerton *blackhole_hton;
static handler *blackhole_create_handler(TABLE_SHARE *table,
static handler *blackhole_create_handler(handlerton *hton,
TABLE_SHARE *table,
MEM_ROOT *mem_root)
{
return new (mem_root) ha_blackhole(table);
return new (mem_root) ha_blackhole(hton, table);
}
......@@ -36,8 +37,9 @@ static handler *blackhole_create_handler(TABLE_SHARE *table,
** BLACKHOLE tables
*****************************************************************************/
ha_blackhole::ha_blackhole(TABLE_SHARE *table_arg)
:handler(blackhole_hton, table_arg)
ha_blackhole::ha_blackhole(handlerton *hton,
TABLE_SHARE *table_arg)
:handler(hton, table_arg)
{}
......
......@@ -28,7 +28,7 @@ class ha_blackhole: public handler
THR_LOCK thr_lock;
public:
ha_blackhole(TABLE_SHARE *table_arg);
ha_blackhole(handlerton *hton, TABLE_SHARE *table_arg);
~ha_blackhole()
{
}
......
......@@ -74,7 +74,9 @@ static int write_meta_file(File meta_file, ha_rows rows, bool dirty);
pthread_mutex_t tina_mutex;
static HASH tina_open_tables;
static int tina_init= 0;
static handler *tina_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root);
static handler *tina_create_handler(handlerton *hton,
TABLE_SHARE *table,
MEM_ROOT *mem_root);
off_t Transparent_file::read_next()
{
......@@ -493,14 +495,16 @@ off_t find_eoln_buff(Transparent_file *data_buff, off_t begin,
}
static handler *tina_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root)
static handler *tina_create_handler(handlerton *hton,
TABLE_SHARE *table,
MEM_ROOT *mem_root)
{
return new (mem_root) ha_tina(table);
return new (mem_root) ha_tina(hton, table);
}
ha_tina::ha_tina(TABLE_SHARE *table_arg)
:handler(tina_hton, table_arg),
ha_tina::ha_tina(handlerton *hton, TABLE_SHARE *table_arg)
:handler(hton, table_arg),
/*
These definitions are found in handler.h
They are not probably completely right.
......
......@@ -129,7 +129,7 @@ class ha_tina: public handler
int init_tina_writer();
public:
ha_tina(TABLE_SHARE *table_arg);
ha_tina(handlerton *hton, TABLE_SHARE *table_arg);
~ha_tina()
{
if (chain_alloced)
......
......@@ -73,7 +73,9 @@
#include <mysql/plugin.h>
static handler *example_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root);
static handler *example_create_handler(handlerton *hton,
TABLE_SHARE *table,
MEM_ROOT *mem_root);
static int example_init_func();
static bool example_init_func_for_handlerton();
static int example_panic(enum ha_panic_function flag);
......@@ -201,14 +203,16 @@ static int free_share(EXAMPLE_SHARE *share)
}
static handler* example_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root)
static handler* example_create_handler(handlerton *hton,
TABLE_SHARE *table,
MEM_ROOT *mem_root)
{
return new (mem_root) ha_example(table);
return new (mem_root) ha_example(hton, table);
}
ha_example::ha_example(TABLE_SHARE *table_arg)
:handler(example_hton, table_arg)
ha_example::ha_example(handlerton *hton, TABLE_SHARE *table_arg)
:handler(hton, table_arg)
{}
/*
......
......@@ -45,7 +45,7 @@ class ha_example: public handler
EXAMPLE_SHARE *share; /* Shared lock info */
public:
ha_example(TABLE_SHARE *table_arg);
ha_example(handlerton *hton, TABLE_SHARE *table_arg);
~ha_example()
{
}
......
......@@ -359,7 +359,8 @@ static const uint sizeof_trailing_and= sizeof(" AND ") - 1;
static const uint sizeof_trailing_where= sizeof(" WHERE ") - 1;
/* Static declaration for handerton */
static handler *federated_create_handler(TABLE_SHARE *table,
static handler *federated_create_handler(handlerton *hton,
TABLE_SHARE *table,
MEM_ROOT *mem_root);
static int federated_commit(THD *thd, bool all);
static int federated_rollback(THD *thd, bool all);
......@@ -368,10 +369,11 @@ static int federated_rollback(THD *thd, bool all);
handlerton *federated_hton;
static handler *federated_create_handler(TABLE_SHARE *table,
static handler *federated_create_handler(handlerton *hton,
TABLE_SHARE *table,
MEM_ROOT *mem_root)
{
return new (mem_root) ha_federated(table);
return new (mem_root) ha_federated(hton, table);
}
......@@ -723,8 +725,9 @@ static int parse_url(FEDERATED_SHARE *share, TABLE *table,
** FEDERATED tables
*****************************************************************************/
ha_federated::ha_federated(TABLE_SHARE *table_arg)
:handler(federated_hton, table_arg),
ha_federated::ha_federated(handlerton *hton,
TABLE_SHARE *table_arg)
:handler(hton, table_arg),
mysql(0), stored_result(0)
{
trx_next= 0;
......
......@@ -94,7 +94,7 @@ class ha_federated: public handler
int stash_remote_error();
public:
ha_federated(TABLE_SHARE *table_arg);
ha_federated(handlerton *hton, TABLE_SHARE *table_arg);
~ha_federated() {}
/* The name that will be used for display purposes */
const char *table_type() const { return "FEDERATED"; }
......
......@@ -25,7 +25,9 @@
#include "ha_heap.h"
static handler *heap_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root);
static handler *heap_create_handler(handlerton *hton,
TABLE_SHARE *table,
MEM_ROOT *mem_root);
handlerton *heap_hton;
......@@ -41,9 +43,11 @@ int heap_init(void *p)
return 0;
}
static handler *heap_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root)
static handler *heap_create_handler(handlerton *hton,
TABLE_SHARE *table,
MEM_ROOT *mem_root)
{
return new (mem_root) ha_heap(table);
return new (mem_root) ha_heap(hton, table);
}
......@@ -51,8 +55,8 @@ static handler *heap_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root)
** HEAP tables
*****************************************************************************/
ha_heap::ha_heap(TABLE_SHARE *table_arg)
:handler(heap_hton, table_arg), file(0), records_changed(0),
ha_heap::ha_heap(handlerton *hton, TABLE_SHARE *table_arg)
:handler(hton, table_arg), file(0), records_changed(0),
key_stat_version(0)
{}
......
......@@ -31,7 +31,7 @@ class ha_heap: public handler
uint records_changed;
uint key_stat_version;
public:
ha_heap(TABLE_SHARE *table);
ha_heap(handlerton *hton, TABLE_SHARE *table);
~ha_heap() {}
const char *table_type() const
{
......
......@@ -203,16 +203,19 @@ static int innobase_rollback(THD* thd, bool all);
static int innobase_rollback_to_savepoint(THD* thd, void *savepoint);
static int innobase_savepoint(THD* thd, void *savepoint);
static int innobase_release_savepoint(THD* thd, void *savepoint);
static handler *innobase_create_handler(TABLE_SHARE *table,
static handler *innobase_create_handler(handlerton *hton,
TABLE_SHARE *table,
MEM_ROOT *mem_root);
static const char innobase_hton_name[]= "InnoDB";
handlerton *innobase_hton;
static handler *innobase_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root)
static handler *innobase_create_handler(handlerton *hton,
TABLE_SHARE *table,
MEM_ROOT *mem_root)
{
return new (mem_root) ha_innobase(table);
return new (mem_root) ha_innobase(hton, table);
}
......@@ -889,7 +892,7 @@ check_trx_exists(
/*************************************************************************
Construct ha_innobase handler. */
ha_innobase::ha_innobase(TABLE_SHARE *table_arg)
ha_innobase::ha_innobase(handlerton *hton, TABLE_SHARE *table_arg)
:handler(innobase_hton, table_arg),
int_table_flags(HA_REC_NOT_IN_SEQ |
HA_NULL_IN_KEY |
......
......@@ -80,7 +80,7 @@ class ha_innobase: public handler
/* Init values for the class: */
public:
ha_innobase(TABLE_SHARE *table_arg);
ha_innobase(handlerton *hton, TABLE_SHARE *table_arg);
~ha_innobase() {}
/*
Get the row type from the storage engine. If this method returns
......
......@@ -48,9 +48,11 @@ TYPELIB myisam_stats_method_typelib= {
** MyISAM tables
*****************************************************************************/
static handler *myisam_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root)
static handler *myisam_create_handler(handlerton *hton,
TABLE_SHARE *table,
MEM_ROOT *mem_root)
{
return new (mem_root) ha_myisam(table);
return new (mem_root) ha_myisam(hton, table);
}
// collect errors printed by mi_check routines
......@@ -133,8 +135,8 @@ void mi_check_print_warning(MI_CHECK *param, const char *fmt,...)
}
ha_myisam::ha_myisam(TABLE_SHARE *table_arg)
:handler(myisam_hton, table_arg), file(0),
ha_myisam::ha_myisam(handlerton *hton, TABLE_SHARE *table_arg)
:handler(hton, table_arg), file(0),
int_table_flags(HA_NULL_IN_KEY | HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER |
HA_DUPLICATE_POS | HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY |
HA_FILE_BASED | HA_CAN_GEOMETRY | HA_NO_TRANSACTIONS |
......@@ -1792,11 +1794,11 @@ handlerton *myisam_hton;
static int myisam_init(void *p)
{
myisam_hton= (handlerton *)p;
myisam_hton->state=SHOW_OPTION_YES;
myisam_hton->db_type=DB_TYPE_MYISAM;
myisam_hton->create=myisam_create_handler;
myisam_hton->panic=mi_panic;
myisam_hton->flags=HTON_CAN_RECREATE;
myisam_hton->state= SHOW_OPTION_YES;
myisam_hton->db_type= DB_TYPE_MYISAM;
myisam_hton->create= myisam_create_handler;
myisam_hton->panic= mi_panic;
myisam_hton->flags= HTON_CAN_RECREATE;
return 0;
}
......
......@@ -43,7 +43,7 @@ class ha_myisam: public handler
int repair(THD *thd, MI_CHECK &param, bool optimize);
public:
ha_myisam(TABLE_SHARE *table_arg);
ha_myisam(handlerton *hton, TABLE_SHARE *table_arg);
~ha_myisam() {}
handler *clone(MEM_ROOT *mem_root);
const char *table_type() const { return "MyISAM"; }
......
......@@ -38,15 +38,16 @@ static handler *myisammrg_create_handler(TABLE_SHARE *table,
handlerton *myisammrg_hton;
static handler *myisammrg_create_handler(TABLE_SHARE *table,
static handler *myisammrg_create_handler(handlerton *hton,
TABLE_SHARE *table,
MEM_ROOT *mem_root)
{
return new (mem_root) ha_myisammrg(table);
return new (mem_root) ha_myisammrg(hton, table);
}
ha_myisammrg::ha_myisammrg(TABLE_SHARE *table_arg)
:handler(myisammrg_hton, table_arg), file(0)
ha_myisammrg::ha_myisammrg(handlerton *hton, TABLE_SHARE *table_arg)
:handler(hton, table_arg), file(0)
{}
static const char *ha_myisammrg_exts[] = {
......
......@@ -28,7 +28,7 @@ class ha_myisammrg: public handler
MYRG_INFO *file;
public:
ha_myisammrg(TABLE_SHARE *table_arg);
ha_myisammrg(handlerton *hton, TABLE_SHARE *table_arg);
~ha_myisammrg() {}
const char *table_type() const { return "MRG_MyISAM"; }
const char **bas_ext() const;
......
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