~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Monty Taylor
  • Date: 2010-10-21 23:10:12 UTC
  • mto: (1879.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1880.
  • Revision ID: mordred@inaugust.com-20101021231012-uhsebiqo23xi0ygy
Updated AUTHORS list with everyone from bzr logs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
12
 
13
13
You should have received a copy of the GNU General Public License along with
14
 
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15
 
Place, Suite 330, Boston, MA 02111-1307 USA
 
14
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
 
15
St, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
*****************************************************************************/
18
18
 
81
81
 
82
82
/*******************************************************************//**
83
83
Tries to find column names for the index and sets the col field of the
84
 
index. */
 
84
index.
 
85
@return TRUE if the column names were found */
85
86
static
86
 
void
 
87
ibool
87
88
dict_index_find_cols(
88
89
/*=================*/
89
90
        dict_table_t*   table,  /*!< in: table */
1168
1169
        ulint                   i;
1169
1170
 
1170
1171
        for (i = 0; i < UT_ARR_SIZE(reserved_names); i++) {
1171
 
                if (strcmp(name, reserved_names[i]) == 0) {
 
1172
                if (innobase_strcasecmp(name, reserved_names[i]) == 0) {
1172
1173
 
1173
1174
                        return(TRUE);
1174
1175
                }
1198
1199
                = TRX_UNDO_PAGE_HDR - TRX_UNDO_PAGE_HDR_SIZE
1199
1200
                + 2 /* next record pointer */
1200
1201
                + 1 /* type_cmpl */
1201
 
                + 11 /* trx->undo_no */ - 11 /* table->id */
 
1202
                + 11 /* trx->undo_no */ + 11 /* table->id */
1202
1203
                + 1 /* rec_get_info_bits() */
1203
1204
                + 11 /* DB_TRX_ID */
1204
1205
                + 11 /* DB_ROLL_PTR */
1430
1431
 
1431
1432
/**********************************************************************//**
1432
1433
Adds an index to the dictionary cache.
1433
 
@return DB_SUCCESS or DB_TOO_BIG_RECORD */
 
1434
@return DB_SUCCESS, DB_TOO_BIG_RECORD, or DB_CORRUPTION */
1434
1435
UNIV_INTERN
1435
1436
ulint
1436
1437
dict_index_add_to_cache(
1456
1457
        ut_a(!dict_index_is_clust(index)
1457
1458
             || UT_LIST_GET_LEN(table->indexes) == 0);
1458
1459
 
1459
 
        dict_index_find_cols(table, index);
 
1460
        if (!dict_index_find_cols(table, index)) {
 
1461
 
 
1462
                return(DB_CORRUPTION);
 
1463
        }
1460
1464
 
1461
1465
        /* Build the cache internal representation of the index,
1462
1466
        containing also the added system fields */
1664
1668
 
1665
1669
/*******************************************************************//**
1666
1670
Tries to find column names for the index and sets the col field of the
1667
 
index. */
 
1671
index.
 
1672
@return TRUE if the column names were found */
1668
1673
static
1669
 
void
 
1674
ibool
1670
1675
dict_index_find_cols(
1671
1676
/*=================*/
1672
1677
        dict_table_t*   table,  /*!< in: table */
1691
1696
                        }
1692
1697
                }
1693
1698
 
 
1699
#ifdef UNIV_DEBUG
1694
1700
                /* It is an error not to find a matching column. */
1695
1701
                fputs("InnoDB: Error: no matching column for ", stderr);
1696
1702
                ut_print_name(stderr, NULL, FALSE, field->name);
1697
1703
                fputs(" in ", stderr);
1698
1704
                dict_index_name_print(stderr, NULL, index);
1699
1705
                fputs("!\n", stderr);
1700
 
                ut_error;
 
1706
#endif /* UNIV_DEBUG */
 
1707
                return(FALSE);
1701
1708
 
1702
1709
found:
1703
1710
                ;
1704
1711
        }
 
1712
 
 
1713
        return(TRUE);
1705
1714
}
1706
1715
#endif /* !UNIV_HOTBACKUP */
1707
1716
 
1740
1749
        if (field->fixed_len > DICT_MAX_INDEX_COL_LEN) {
1741
1750
                field->fixed_len = 0;
1742
1751
        }
1743
 
#if DICT_MAX_INDEX_COL_LEN != 768
 
1752
#if DICT_MAX_INDEX_COL_LEN != 1024
1744
1753
        /* The comparison limit above must be constant.  If it were
1745
1754
        changed, the disk format of some fixed-length columns would
1746
1755
        change, which would be a disaster. */
1747
 
# error "DICT_MAX_INDEX_COL_LEN != 768"
 
1756
# error "DICT_MAX_INDEX_COL_LEN != 1024"
1748
1757
#endif
1749
1758
 
1750
1759
        if (!(col->prtype & DATA_NOT_NULL)) {
4642
4651
        dict_ind_redundant->cached = dict_ind_compact->cached = TRUE;
4643
4652
}
4644
4653
 
 
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
 
4645
4674
#ifndef UNIV_HOTBACKUP
4646
4675
/**********************************************************************//**
4647
4676
Get index by name
4767
4796
        }
4768
4797
}
4769
4798
#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
}
4770
4850
#endif /* !UNIV_HOTBACKUP */