Commit 76b83865 authored by unknown's avatar unknown
Browse files

This patch adds handlerton passing to functions. NDB and Innodb still require...

This patch adds handlerton passing to functions. NDB and Innodb still require a global hanlderton in the main code due to the nature of the sql_cache call back function (should be solveable... another patch).
Partitioning now has a flag to allow disabling of engines from being compatible with partitioning. Cleaned up heap naming convention on panic call. 


include/heap.h:
  Added new function
sql/ha_ndbcluster.cc:
  Updated hanlderton functions
sql/ha_ndbcluster_binlog.cc:
  Updated handlerton functions.
sql/handler.cc:
  Updated handlerton functions.
sql/handler.h:
  Updated hanlderton functions
sql/log.cc:
  Updated handlerton functions
sql/mysql_priv.h:
  Updated handlerton functions
sql/mysqld.cc:
  Added Legacy handlerton functions
sql/partition_info.cc:
  Added flag support for marking engines not compatible with partitioning
sql/sql_cursor.cc:
  Updated hanlderton functions
sql/sql_show.cc:
  Updated hanlderton functions
sql/sql_tablespace.cc:
  Update for handlerton functions
storage/archive/ha_archive.cc:
  Update for hanlderton functions
storage/archive/ha_archive.h:
  Update for handlerton functions
storage/blackhole/ha_blackhole.cc:
  Update for handlerton functions
storage/csv/ha_tina.cc:
  Update for handlerton functions
storage/csv/ha_tina.h:
  Update for handlerton functions
storage/federated/ha_federated.cc:
  Updated for handlerton functions
storage/federated/ha_federated.h:
  Updated for handlerton functions
storage/heap/ha_heap.cc:
  Update for handlerton functions
storage/heap/hp_panic.c:
  Update of function name
storage/heap/hp_test1.c:
  Update of function name
storage/heap/hp_test2.c:
  Update of function name.
storage/innobase/handler/ha_innodb.cc:
  Update of function name
storage/innobase/handler/ha_innodb.h:
  Update of function name
storage/myisam/ha_myisam.cc:
  Update of function name.
storage/myisammrg/ha_myisammrg.cc:
  Update of function name
parent 48d5b3bd
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -225,6 +225,7 @@ extern int heap_indexes_are_disabled(HP_INFO *info);
extern void heap_update_auto_increment(HP_INFO *info, const byte *record);
ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, key_range *min_key,
                               key_range *max_key);
int hp_panic(enum ha_panic_function flag);
int heap_rkey(HP_INFO *info, byte *record, int inx, const byte *key, 
              uint key_len, enum ha_rkey_function find_flag);
extern gptr heap_find(HP_INFO *info,int inx,const byte *key);
+31 −17
Original line number Diff line number Diff line
@@ -75,10 +75,17 @@ 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);
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);

handlerton *ndbcluster_hton;

@@ -4202,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);
@@ -4253,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);
@@ -5817,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");
@@ -5834,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;
@@ -5915,7 +5924,8 @@ int ndbcluster_discover(THD* thd, const char *db, const char *name,

 */

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;
@@ -6015,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");
@@ -6176,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");
@@ -6286,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();
@@ -6540,7 +6552,7 @@ static int ndbcluster_init(void *p)
  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");

@@ -9704,7 +9716,7 @@ char* ha_ndbcluster::get_tablespace_name(THD *thd)
  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];
@@ -10168,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");

@@ -10429,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;
+4 −2
Original line number Diff line number Diff line
@@ -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)
  {
+59 −32
Original line number Diff line number Diff line
@@ -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,28 @@ 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. 
  */
  switch (hton->db_type) {
  case DB_TYPE_MRG_ISAM:
    myisammrg_hton= hton;
    break;
  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 +520,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 +542,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 +563,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 +639,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 +713,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 +760,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 +816,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 +893,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 +905,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 +1015,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 +1046,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 +1055,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 +1201,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 +1234,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 +1250,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 +1284,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 +1310,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 +1329,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 +1357,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 +1375,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 +2790,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 +2841,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 +2888,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 +2957,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 +3004,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 +3022,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)
@@ -3371,7 +3398,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 +3432,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 +3753,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 */
+39 −33
Original line number Diff line number Diff line
@@ -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)();
   void (*set_cursor_read_view)(void *);
   void (*close_cursor_read_view)(void *);
   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);
   void (*set_cursor_read_view)(handlerton *hton, void *);
   void (*close_cursor_read_view)(handlerton *hton, void *);
   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);
   bool (*flush_logs)();
   bool (*show_status)(THD *thd, stat_print_fn *print, enum ha_stat_type stat);
   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);
};

@@ -690,6 +695,7 @@ struct handlerton
#define HTON_FLUSH_AFTER_RENAME      (1 << 4)
#define HTON_NOT_USER_SELECTABLE     (1 << 5)
#define HTON_TEMPORARY_NOT_SUPPORTED (1 << 6) //Having temporary tables not supported
#define HTON_NO_PARTITION            (1 << 7) //You can not partition these tables

typedef struct st_thd_trans
{
@@ -892,7 +898,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 */

@@ -942,7 +948,7 @@ class handler :public Sql_alloc
  */
  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)),
@@ -1715,7 +1721,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);
Loading