~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/handler.cc

  • Committer: Monty Taylor
  • Date: 2009-03-24 17:44:41 UTC
  • mto: (960.5.2 mordred)
  • mto: This revision was merged to the branch mainline in revision 964.
  • Revision ID: mordred@inaugust.com-20090324174441-nmsq0gwjlgf7f0mt
Changed handlerton to StorageEngine.

Show diffs side-by-side

added added

removed removed

Lines of Context:
188
188
                              plugin_ref plugin,
189
189
                              void *path)
190
190
{
191
 
  handlerton *hton= plugin_data(plugin, handlerton *);
 
191
  StorageEngine *hton= plugin_data(plugin, StorageEngine *);
192
192
  if (hton->state == SHOW_OPTION_YES && hton->drop_database)
193
193
    hton->drop_database(hton, (char *)path);
194
194
  return false;
204
204
static bool closecon_handlerton(Session *session, plugin_ref plugin,
205
205
                                void *)
206
206
{
207
 
  handlerton *hton= plugin_data(plugin, handlerton *);
 
207
  StorageEngine *hton= plugin_data(plugin, StorageEngine *);
208
208
  /*
209
209
    there's no need to rollback here as all transactions must
210
210
    be rolled back already
405
405
  in each engine independently. The two-phase commit protocol
406
406
  is used only if:
407
407
  - all participating engines support two-phase commit (provide
408
 
    handlerton::prepare PSEA API call) and
 
408
    StorageEngine::prepare PSEA API call) and
409
409
  - transactions in at least two engines modify data (i.e. are
410
410
  not read-only).
411
411
 
469
469
 
470
470
  At the end of a statement, server call
471
471
  ha_autocommit_or_rollback() is invoked. This call in turn
472
 
  invokes handlerton::prepare() for every involved engine.
473
 
  Prepare is followed by a call to handlerton::commit_one_phase()
474
 
  If a one-phase commit will suffice, handlerton::prepare() is not
475
 
  invoked and the server only calls handlerton::commit_one_phase().
 
472
  invokes StorageEngine::prepare() for every involved engine.
 
473
  Prepare is followed by a call to StorageEngine::commit_one_phase()
 
474
  If a one-phase commit will suffice, StorageEngine::prepare() is not
 
475
  invoked and the server only calls StorageEngine::commit_one_phase().
476
476
  At statement commit, the statement-related read-write engine
477
477
  flag is propagated to the corresponding flag in the normal
478
478
  transaction.  When the commit is complete, the list of registered
531
531
    times per transaction.
532
532
 
533
533
*/
534
 
void trans_register_ha(Session *session, bool all, handlerton *ht_arg)
 
534
void trans_register_ha(Session *session, bool all, StorageEngine *ht_arg)
535
535
{
536
536
  Session_TRANS *trans;
537
537
  Ha_trx_info *ha_info;
574
574
    for (; ha_info; ha_info= ha_info->next())
575
575
    {
576
576
      int err;
577
 
      handlerton *ht= ha_info->ht();
 
577
      StorageEngine *ht= ha_info->ht();
578
578
      status_var_increment(session->status_var.ha_prepare_count);
579
579
      if (ht->prepare)
580
580
      {
704
704
      for (; ha_info && !error; ha_info= ha_info->next())
705
705
      {
706
706
        int err;
707
 
        handlerton *ht= ha_info->ht();
 
707
        StorageEngine *ht= ha_info->ht();
708
708
        /*
709
709
          Do not call two-phase commit if this particular
710
710
          transaction is read-only. This allows for simpler
753
753
    for (; ha_info; ha_info= ha_info_next)
754
754
    {
755
755
      int err;
756
 
      handlerton *ht= ha_info->ht();
 
756
      StorageEngine *ht= ha_info->ht();
757
757
      if ((err= ht->commit(ht, session, all)))
758
758
      {
759
759
        my_error(ER_ERROR_DURING_COMMIT, MYF(0), err);
796
796
    for (; ha_info; ha_info= ha_info_next)
797
797
    {
798
798
      int err;
799
 
      handlerton *ht= ha_info->ht();
 
799
      StorageEngine *ht= ha_info->ht();
800
800
      if ((err= ht->rollback(ht, session, all)))
801
801
      { // cannot happen
802
802
        my_error(ER_ERROR_DURING_ROLLBACK, MYF(0), err);
877
877
                                plugin_ref plugin,
878
878
                                void *arg)
879
879
{
880
 
  handlerton *hton= plugin_data(plugin, handlerton *);
 
880
  StorageEngine *hton= plugin_data(plugin, StorageEngine *);
881
881
  if (hton->state == SHOW_OPTION_YES && hton->recover)
882
882
  {
883
883
    hton->commit_by_xid(hton, ((struct xahton_st *)arg)->xid);
890
890
                                  plugin_ref plugin,
891
891
                                  void *arg)
892
892
{
893
 
  handlerton *hton= plugin_data(plugin, handlerton *);
 
893
  StorageEngine *hton= plugin_data(plugin, StorageEngine *);
894
894
  if (hton->state == SHOW_OPTION_YES && hton->recover)
895
895
  {
896
896
    hton->rollback_by_xid(hton, ((struct xahton_st *)arg)->xid);
940
940
                                 plugin_ref plugin,
941
941
                                 void *arg)
942
942
{
943
 
  handlerton *hton= plugin_data(plugin, handlerton *);
 
943
  StorageEngine *hton= plugin_data(plugin, StorageEngine *);
944
944
  struct xarecover_st *info= (struct xarecover_st *) arg;
945
945
  int got;
946
946
 
1120
1120
static bool release_temporary_latches(Session *session, plugin_ref plugin,
1121
1121
                                      void *)
1122
1122
{
1123
 
  handlerton *hton= plugin_data(plugin, handlerton *);
 
1123
  StorageEngine *hton= plugin_data(plugin, StorageEngine *);
1124
1124
 
1125
1125
  if (hton->state == SHOW_OPTION_YES && hton->release_temporary_latches)
1126
1126
    hton->release_temporary_latches(hton, session);
1151
1151
  for (ha_info= sv->ha_list; ha_info; ha_info= ha_info->next())
1152
1152
  {
1153
1153
    int err;
1154
 
    handlerton *ht= ha_info->ht();
 
1154
    StorageEngine *ht= ha_info->ht();
1155
1155
    assert(ht);
1156
1156
    assert(ht->savepoint_set != 0);
1157
1157
    if ((err= ht->savepoint_rollback(ht, session,
1171
1171
       ha_info= ha_info_next)
1172
1172
  {
1173
1173
    int err;
1174
 
    handlerton *ht= ha_info->ht();
 
1174
    StorageEngine *ht= ha_info->ht();
1175
1175
    if ((err= ht->rollback(ht, session, !(0))))
1176
1176
    { // cannot happen
1177
1177
      my_error(ER_ERROR_DURING_ROLLBACK, MYF(0), err);
1199
1199
  for (; ha_info; ha_info= ha_info->next())
1200
1200
  {
1201
1201
    int err;
1202
 
    handlerton *ht= ha_info->ht();
 
1202
    StorageEngine *ht= ha_info->ht();
1203
1203
    assert(ht);
1204
1204
    if (! ht->savepoint_set)
1205
1205
    {
1230
1230
  for (; ha_info; ha_info= ha_info->next())
1231
1231
  {
1232
1232
    int err;
1233
 
    handlerton *ht= ha_info->ht();
 
1233
    StorageEngine *ht= ha_info->ht();
1234
1234
    /* Savepoint life time is enclosed into transaction life time. */
1235
1235
    assert(ht);
1236
1236
    if (!ht->savepoint_release)
1248
1248
 
1249
1249
static bool snapshot_handlerton(Session *session, plugin_ref plugin, void *arg)
1250
1250
{
1251
 
  handlerton *hton= plugin_data(plugin, handlerton *);
 
1251
  StorageEngine *hton= plugin_data(plugin, StorageEngine *);
1252
1252
  if (hton->state == SHOW_OPTION_YES &&
1253
1253
      hton->start_consistent_snapshot)
1254
1254
  {
1280
1280
                             plugin_ref plugin,
1281
1281
                             void *)
1282
1282
{
1283
 
  handlerton *hton= plugin_data(plugin, handlerton *);
 
1283
  StorageEngine *hton= plugin_data(plugin, StorageEngine *);
1284
1284
  if (hton->state == SHOW_OPTION_YES && hton->flush_logs &&
1285
1285
      hton->flush_logs(hton))
1286
1286
    return true;
1288
1288
}
1289
1289
 
1290
1290
 
1291
 
bool ha_flush_logs(handlerton *db_type)
 
1291
bool ha_flush_logs(StorageEngine *db_type)
1292
1292
{
1293
1293
  if (db_type == NULL)
1294
1294
  {
1377
1377
  if(dtargs->error!=ENOENT) /* already deleted table */
1378
1378
    return false;
1379
1379
 
1380
 
  handlerton *table_type= plugin_data(plugin, handlerton *);
 
1380
  StorageEngine *table_type= plugin_data(plugin, StorageEngine *);
1381
1381
 
1382
1382
  if(!table_type)
1383
1383
    return false;
2995
2995
  const char *db;
2996
2996
  const char *name;
2997
2997
  int err;
2998
 
  handlerton* hton;
 
2998
  StorageEngine* hton;
2999
2999
};
3000
3000
 
3001
3001
static bool table_exists_in_engine_handlerton(Session *session, plugin_ref plugin,
3002
3002
                                              void *arg)
3003
3003
{
3004
3004
  st_table_exists_in_engine_args *vargs= (st_table_exists_in_engine_args *)arg;
3005
 
  handlerton *hton= plugin_data(plugin, handlerton *);
 
3005
  StorageEngine *hton= plugin_data(plugin, StorageEngine *);
3006
3006
 
3007
3007
  int err= HA_ERR_NO_SUCH_TABLE;
3008
3008
 
3021
3021
 
3022
3022
int ha_table_exists_in_engine(Session* session,
3023
3023
                              const char* db, const char* name,
3024
 
                              handlerton **hton)
 
3024
                              StorageEngine **hton)
3025
3025
{
3026
3026
  st_table_exists_in_engine_args args= {db, name, HA_ERR_NO_SUCH_TABLE, NULL};
3027
3027
  plugin_foreach(session, table_exists_in_engine_handlerton,
3050
3050
                                 strlen(table.engine().name().c_str()) };
3051
3051
        plugin_ref plugin= ha_resolve_by_name(session, &engine_name);
3052
3052
        if(plugin)
3053
 
          args.hton= plugin_data(plugin,handlerton *);
 
3053
          args.hton= plugin_data(plugin,StorageEngine *);
3054
3054
      }
3055
3055
    }
3056
3056
  }
4089
4089
                            void *arg)
4090
4090
{
4091
4091
  List<char> *found_exts= (List<char> *) arg;
4092
 
  handlerton *hton= plugin_data(plugin, handlerton *);
 
4092
  StorageEngine *hton= plugin_data(plugin, StorageEngine *);
4093
4093
  handler *file;
4094
4094
  if (hton->state == SHOW_OPTION_YES && hton->create &&
4095
4095
      (file= hton->create(hton, (TABLE_SHARE*) 0, current_session->mem_root)))
4157
4157
  return false;
4158
4158
}
4159
4159
 
4160
 
bool ha_show_status(Session *session, handlerton *db_type, enum ha_stat_type stat)
 
4160
bool ha_show_status(Session *session, StorageEngine *db_type, enum ha_stat_type stat)
4161
4161
{
4162
4162
  List<Item> field_list;
4163
4163
  Protocol *protocol= session->protocol;