~thomir-deactivatedaccount/drizzle/drizzle-fix-bug653747

« back to all changes in this revision

Viewing changes to plugin/innobase/dict/dict0dict.c

  • Committer: Brian Aker
  • Date: 2010-10-10 02:07:52 UTC
  • mfrom: (1827.2.3 staging)
  • Revision ID: brian@tangent.org-20101010020752-ktv73isay5dxtvp3
Merge in switch on table_share_instance inheritance.

Show diffs side-by-side

added added

removed removed

Lines of Context:
81
81
 
82
82
/*******************************************************************//**
83
83
Tries to find column names for the index and sets the col field of the
84
 
index.
85
 
@return TRUE if the column names were found */
 
84
index. */
86
85
static
87
 
ibool
 
86
void
88
87
dict_index_find_cols(
89
88
/*=================*/
90
89
        dict_table_t*   table,  /*!< in: table */
1169
1168
        ulint                   i;
1170
1169
 
1171
1170
        for (i = 0; i < UT_ARR_SIZE(reserved_names); i++) {
1172
 
                if (innobase_strcasecmp(name, reserved_names[i]) == 0) {
 
1171
                if (strcmp(name, reserved_names[i]) == 0) {
1173
1172
 
1174
1173
                        return(TRUE);
1175
1174
                }
1199
1198
                = TRX_UNDO_PAGE_HDR - TRX_UNDO_PAGE_HDR_SIZE
1200
1199
                + 2 /* next record pointer */
1201
1200
                + 1 /* type_cmpl */
1202
 
                + 11 /* trx->undo_no */ + 11 /* table->id */
 
1201
                + 11 /* trx->undo_no */ - 11 /* table->id */
1203
1202
                + 1 /* rec_get_info_bits() */
1204
1203
                + 11 /* DB_TRX_ID */
1205
1204
                + 11 /* DB_ROLL_PTR */
1431
1430
 
1432
1431
/**********************************************************************//**
1433
1432
Adds an index to the dictionary cache.
1434
 
@return DB_SUCCESS, DB_TOO_BIG_RECORD, or DB_CORRUPTION */
 
1433
@return DB_SUCCESS or DB_TOO_BIG_RECORD */
1435
1434
UNIV_INTERN
1436
1435
ulint
1437
1436
dict_index_add_to_cache(
1457
1456
        ut_a(!dict_index_is_clust(index)
1458
1457
             || UT_LIST_GET_LEN(table->indexes) == 0);
1459
1458
 
1460
 
        if (!dict_index_find_cols(table, index)) {
1461
 
 
1462
 
                return(DB_CORRUPTION);
1463
 
        }
 
1459
        dict_index_find_cols(table, index);
1464
1460
 
1465
1461
        /* Build the cache internal representation of the index,
1466
1462
        containing also the added system fields */
1668
1664
 
1669
1665
/*******************************************************************//**
1670
1666
Tries to find column names for the index and sets the col field of the
1671
 
index.
1672
 
@return TRUE if the column names were found */
 
1667
index. */
1673
1668
static
1674
 
ibool
 
1669
void
1675
1670
dict_index_find_cols(
1676
1671
/*=================*/
1677
1672
        dict_table_t*   table,  /*!< in: table */
1696
1691
                        }
1697
1692
                }
1698
1693
 
1699
 
#ifdef UNIV_DEBUG
1700
1694
                /* It is an error not to find a matching column. */
1701
1695
                fputs("InnoDB: Error: no matching column for ", stderr);
1702
1696
                ut_print_name(stderr, NULL, FALSE, field->name);
1703
1697
                fputs(" in ", stderr);
1704
1698
                dict_index_name_print(stderr, NULL, index);
1705
1699
                fputs("!\n", stderr);
1706
 
#endif /* UNIV_DEBUG */
1707
 
                return(FALSE);
 
1700
                ut_error;
1708
1701
 
1709
1702
found:
1710
1703
                ;
1711
1704
        }
1712
 
 
1713
 
        return(TRUE);
1714
1705
}
1715
1706
#endif /* !UNIV_HOTBACKUP */
1716
1707
 
4651
4642
        dict_ind_redundant->cached = dict_ind_compact->cached = TRUE;
4652
4643
}
4653
4644
 
4654
 
/**********************************************************************//**
4655
 
Frees dict_ind_redundant and dict_ind_compact. */
4656
 
static
4657
 
void
4658
 
dict_ind_free(void)
4659
 
/*===============*/
4660
 
{
4661
 
        dict_table_t*   table;
4662
 
 
4663
 
        table = dict_ind_compact->table;
4664
 
        dict_mem_index_free(dict_ind_compact);
4665
 
        dict_ind_compact = NULL;
4666
 
        dict_mem_table_free(table);
4667
 
 
4668
 
        table = dict_ind_redundant->table;
4669
 
        dict_mem_index_free(dict_ind_redundant);
4670
 
        dict_ind_redundant = NULL;
4671
 
        dict_mem_table_free(table);
4672
 
}
4673
 
 
4674
4645
#ifndef UNIV_HOTBACKUP
4675
4646
/**********************************************************************//**
4676
4647
Get index by name
4796
4767
        }
4797
4768
}
4798
4769
#endif /* UNIV_DEBUG */
4799
 
 
4800
 
/**************************************************************************
4801
 
Closes the data dictionary module. */
4802
 
UNIV_INTERN
4803
 
void
4804
 
dict_close(void)
4805
 
/*============*/
4806
 
{
4807
 
        ulint   i;
4808
 
 
4809
 
        /* Free the hash elements. We don't remove them from the table
4810
 
        because we are going to destroy the table anyway. */
4811
 
        for (i = 0; i < hash_get_n_cells(dict_sys->table_hash); i++) {
4812
 
                dict_table_t*   table;
4813
 
 
4814
 
                table = HASH_GET_FIRST(dict_sys->table_hash, i);
4815
 
 
4816
 
                while (table) {
4817
 
                        dict_table_t*   prev_table = table;
4818
 
 
4819
 
                        table = HASH_GET_NEXT(name_hash, prev_table);
4820
 
#ifdef UNIV_DEBUG
4821
 
                        ut_a(prev_table->magic_n == DICT_TABLE_MAGIC_N);
4822
 
#endif
4823
 
                        /* Acquire only because it's a pre-condition. */
4824
 
                        mutex_enter(&dict_sys->mutex);
4825
 
 
4826
 
                        dict_table_remove_from_cache(prev_table);
4827
 
 
4828
 
                        mutex_exit(&dict_sys->mutex);
4829
 
                }
4830
 
        }
4831
 
 
4832
 
        hash_table_free(dict_sys->table_hash);
4833
 
 
4834
 
        /* The elements are the same instance as in dict_sys->table_hash,
4835
 
        therefore we don't delete the individual elements. */
4836
 
        hash_table_free(dict_sys->table_id_hash);
4837
 
 
4838
 
        dict_ind_free();
4839
 
 
4840
 
        mutex_free(&dict_sys->mutex);
4841
 
 
4842
 
        rw_lock_free(&dict_operation_lock);
4843
 
        memset(&dict_operation_lock, 0x0, sizeof(dict_operation_lock));
4844
 
 
4845
 
        mutex_free(&dict_foreign_err_mutex);
4846
 
 
4847
 
        mem_free(dict_sys);
4848
 
        dict_sys = NULL;
4849
 
}
4850
4770
#endif /* !UNIV_HOTBACKUP */