~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/handler/ha_innodb.cc

  • Committer: Monty Taylor
  • Date: 2009-05-06 04:37:59 UTC
  • mto: This revision was merged to the branch mainline in revision 1008.
  • Revision ID: mordred@inaugust.com-20090506043759-a7rk3vqddrh52on0
Updated po files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
130
130
#ifdef DRIZZLE_DYNAMIC_PLUGIN
131
131
/* These must be weak global variables in the dynamic plugin. */
132
132
#ifdef __WIN__
133
 
struct st_mysql_plugin* builtin_innobase_plugin_ptr;
 
133
struct drizzled_plugin_manifest*        builtin_innobase_plugin_ptr;
134
134
#else
135
135
int builtin_innobase_plugin;
136
136
#endif /* __WIN__ */
282
282
                        /* out: 0 or error number */
283
283
        XID     *xid);  /* in: X/Open XA transaction identification */
284
284
 
285
 
  virtual handler *create(TABLE_SHARE *table,
 
285
  virtual handler *create(TableShare *table,
286
286
                          MEM_ROOT *mem_root)
287
287
  {
288
288
    return new (mem_root) ha_innobase(this, table);
397
397
Closes an InnoDB database. */
398
398
static
399
399
int
400
 
innobase_deinit(void *p);
 
400
innobase_deinit(PluginRegistry &registry);
401
401
 
402
402
 
403
403
/*********************************************************************
1297
1297
/*************************************************************************
1298
1298
Construct ha_innobase handler. */
1299
1299
UNIV_INTERN
1300
 
ha_innobase::ha_innobase(StorageEngine *engine_arg, TABLE_SHARE *table_arg)
 
1300
ha_innobase::ha_innobase(StorageEngine *engine_arg, TableShare *table_arg)
1301
1301
  :handler(engine_arg, table_arg),
1302
1302
  int_table_flags(HA_REC_NOT_IN_SEQ |
1303
1303
                  HA_NULL_IN_KEY |
1835
1835
innobase_init(
1836
1836
/*==========*/
1837
1837
                        /* out: 0 on success, error code on failure */
1838
 
        void    *p)     /* in: InnoDB StorageEngine */
 
1838
        PluginRegistry &registry)       /* in: Drizzle Plugin Registry */
1839
1839
{
1840
1840
        static char     current_dir[3];         /* Set if using current lib */
1841
1841
        int             err;
1843
1843
        char            *default_path;
1844
1844
        uint            format_id;
1845
1845
 
1846
 
        StorageEngine **engine= static_cast<StorageEngine **>(p);
1847
 
        InnobaseEngine *innobase_engine= new InnobaseEngine(string(innobase_engine_name));
 
1846
        innodb_engine_ptr= new InnobaseEngine(innobase_engine_name);
1848
1847
 
1849
1848
#ifdef DRIZZLE_DYNAMIC_PLUGIN
1850
1849
        if (!innodb_plugin_init()) {
1853
1852
        }
1854
1853
#endif /* DRIZZLE_DYNAMIC_PLUGIN */
1855
1854
 
1856
 
        innodb_engine_ptr = innobase_engine;
1857
 
 
1858
1855
        ut_a(DATA_MYSQL_TRUE_VARCHAR == (ulint)DRIZZLE_TYPE_VARCHAR);
1859
1856
 
1860
1857
#ifdef UNIV_DEBUG
2096
2093
        pthread_cond_init(&commit_cond, NULL);
2097
2094
        innodb_inited= 1;
2098
2095
 
2099
 
        *engine= innobase_engine;
 
2096
        if (innodb_locks_init() ||
 
2097
                innodb_trx_init() ||
 
2098
                innodb_lock_waits_init() ||
 
2099
                i_s_cmp_init() ||
 
2100
                i_s_cmp_reset_init() ||
 
2101
                i_s_cmpmem_init() ||
 
2102
                i_s_cmpmem_reset_init())
 
2103
                goto error;
 
2104
 
 
2105
        registry.add(innodb_engine_ptr);
 
2106
 
 
2107
        registry.add(innodb_trx_schema_table);
 
2108
        registry.add(innodb_locks_schema_table);
 
2109
        registry.add(innodb_lock_waits_schema_table);   
 
2110
        registry.add(innodb_cmp_schema_table);
 
2111
        registry.add(innodb_cmp_reset_schema_table);
 
2112
        registry.add(innodb_cmpmem_schema_table);
 
2113
        registry.add(innodb_cmpmem_reset_schema_table);
2100
2114
 
2101
2115
        /* Get the current high water mark format. */
2102
2116
        innobase_file_format_check = (char*) trx_sys_file_format_max_get();
2110
2124
Closes an InnoDB database. */
2111
2125
static
2112
2126
int
2113
 
innobase_deinit(void *p)
 
2127
innobase_deinit(PluginRegistry &registry)
2114
2128
/*==============*/
2115
2129
                                /* out: TRUE if error */
2116
2130
{
2117
2131
        int     err= 0;
2118
 
        InnobaseEngine *innobase_engine= static_cast<InnobaseEngine *>(p);
2119
 
        delete innobase_engine;
 
2132
        i_s_common_deinit(registry);
 
2133
        registry.remove(innodb_engine_ptr);
 
2134
        delete innodb_engine_ptr;
2120
2135
 
2121
2136
        if (innodb_inited) {
2122
2137
 
3616
3631
        }
3617
3632
 
3618
3633
        n_fields = (ulint)table->s->fields; /* number of columns */
3619
 
        n_stored_fields= (ulint)table->s->stored_fields; /* number of stored columns */
 
3634
        n_stored_fields= (ulint)table->s->fields; /* number of stored columns */
3620
3635
 
3621
3636
        if (!prebuilt->mysql_template) {
3622
3637
                prebuilt->mysql_template = (mysql_row_templ_t*)
3648
3663
        for (sql_idx = 0; sql_idx < n_fields; sql_idx++) {
3649
3664
                templ = prebuilt->mysql_template + n_requested_fields;
3650
3665
                field = table->field[sql_idx];
3651
 
                if (!field->is_stored)
3652
 
                       goto skip_field;
3653
3666
 
3654
3667
                if (UNIV_LIKELY(templ_type == ROW_MYSQL_REC_FIELDS)) {
3655
3668
                        /* Decide which columns we should fetch
3657
3670
                        register const ibool    index_contains_field =
3658
3671
                                dict_index_contains_col_or_prefix(index, innodb_idx);
3659
3672
                        register const ibool    index_covers_field = 
3660
 
                                field->part_of_key.is_set(file->active_index);
 
3673
                                field->part_of_key.test(file->active_index);
3661
3674
 
3662
3675
 
3663
3676
                        if (!index_contains_field && prebuilt->read_just_key) {
3673
3686
                                goto include_field;
3674
3687
                        }
3675
3688
 
3676
 
                        if (bitmap_is_set(table->read_set, sql_idx) ||
3677
 
                            bitmap_is_set(table->write_set, sql_idx)) {
 
3689
                        if (field->isRead() || field->isWrite())
3678
3690
                                /* This field is needed in the query */
3679
 
 
3680
3691
                                goto include_field;
3681
 
                        }
 
3692
 
 
3693
                        assert(table->read_set->test(sql_idx) == field->isRead());
 
3694
                        assert(table->write_set->test(sql_idx) == field->isWrite());
3682
3695
 
3683
3696
                        if (fetch_primary_key_cols
3684
3697
                                && dict_table_col_in_clustered_key(
3751
3764
                        prebuilt->templ_contains_blob = TRUE;
3752
3765
                }
3753
3766
skip_field:
3754
 
                if (field->is_stored)
3755
 
                {
3756
 
                  innodb_idx++;
3757
 
                }
 
3767
                innodb_idx++;
3758
3768
                if (need_second_pass && (sql_idx+1 == n_fields))
3759
3769
                {
3760
3770
                  prebuilt->n_index_fields= n_requested_fields;
4243
4253
 
4244
4254
        for (sql_idx = 0; sql_idx < n_fields; sql_idx++) {
4245
4255
                field = table->field[sql_idx];
4246
 
                if (!field->is_stored)
4247
 
                  continue;
4248
4256
 
4249
4257
                o_ptr = (const byte*) old_row + get_field_offset(table, field);
4250
4258
                n_ptr = (const byte*) new_row + get_field_offset(table, field);
4339
4347
                                &prebuilt->table->cols[innodb_idx], clust_index);
4340
4348
                        n_changed++;
4341
4349
                }
4342
 
                if (field->is_stored)
4343
 
                  innodb_idx++;
 
4350
                innodb_idx++;
4344
4351
        }
4345
4352
 
4346
4353
        uvect->n_fields = n_changed;
5323
5330
        /* We pass 0 as the space id, and determine at a lower level the space
5324
5331
        id where to store the table */
5325
5332
 
5326
 
        table = dict_mem_table_create(table_name, 0, form->s->stored_fields, flags);
 
5333
        table = dict_mem_table_create(table_name, 0, form->s->fields, flags);
5327
5334
 
5328
5335
        if (path_of_temp_table) {
5329
5336
                table->dir_path_of_temp_table =
5332
5339
 
5333
5340
        for (i = 0; i < n_cols; i++) {
5334
5341
                field = form->field[i];
5335
 
                if (!field->is_stored)
5336
 
                  continue;
5337
5342
 
5338
5343
                col_type = get_innobase_type_from_mysql_type(&unsigned_type,
5339
5344
                                                                        field);
9516
9521
/*====================*/
9517
9522
                /* out: TRUE if the dynamic InnoDB plugin should start */
9518
9523
{
9519
 
# if !DRIZZLE_STORAGE_ENGINE_PLUGIN
9520
 
#  error "DRIZZLE_STORAGE_ENGINE_PLUGIN must be nonzero."
9521
 
# endif
9522
9524
 
9523
9525
        /* Copy the system variables. */
9524
9526
 
9525
 
        struct st_mysql_plugin*         builtin;
 
9527
        struct drizzled_plugin_manifest*                builtin;
9526
9528
        struct st_mysql_sys_var**       sta; /* static parameters */
9527
9529
        struct st_mysql_sys_var**       dyn; /* dynamic parameters */
9528
9530
 
9534
9536
 
9535
9537
        builtin = builtin_innobase_plugin_ptr;
9536
9538
#else
9537
 
        switch (builtin_innobase_plugin) {
9538
 
        case 0:
9539
 
                return(true);
9540
 
        case DRIZZLE_STORAGE_ENGINE_PLUGIN:
9541
 
                break;
9542
 
        default:
9543
 
                return(false);
9544
 
        }
9545
9539
 
9546
 
        builtin = (struct st_mysql_plugin*) &builtin_innobase_plugin;
 
9540
        builtin = (struct drizzled_plugin_manifest*) &builtin_innobase_plugin;
9547
9541
#endif
9548
9542
 
9549
9543
        for (sta = builtin->system_vars; *sta != NULL; sta++) {
9625
9619
 
9626
9620
drizzle_declare_plugin(innobase)
9627
9621
{
9628
 
  DRIZZLE_STORAGE_ENGINE_PLUGIN,
9629
9622
  innobase_engine_name,
9630
9623
  "1.0.1",
9631
9624
  "Innobase Oy",
9636
9629
  innodb_status_variables_export,/* status variables             */
9637
9630
  innobase_system_variables, /* system variables */
9638
9631
  NULL /* reserved */
9639
 
},
9640
 
i_s_innodb_trx,
9641
 
i_s_innodb_locks,
9642
 
i_s_innodb_lock_waits,
9643
 
i_s_innodb_cmp,
9644
 
i_s_innodb_cmp_reset,
9645
 
i_s_innodb_cmpmem,
9646
 
i_s_innodb_cmpmem_reset
 
9632
}
9647
9633
drizzle_declare_plugin_end;
9648
9634
 
9649
9635