Commit graph

22 commits

Author SHA1 Message Date
osku
fd1bd26ba4 Remove dict_col_t::name, replace it with a packed array of column names in
dict_table_t. This saves 8-15+ bytes of memory per column on 64-bit
machines.
2006-09-19 04:36:56 +00:00
marko
f77f36b246 Change the recently introduced ulint bit-fields to unsigned. 2006-09-18 12:02:43 +00:00
marko
79644bdb8e dict_col_t: Copy the fields of "dtype_t type" directly to this structure,
so that all integer fields can be packed into 64 bits.  (Bug #20877)

dtype_t: Change the type of all bit-fields to unsigned.

dict_table_get_nth_col(), dict_table_get_sys_col_noninline(),
dict_table_get_sys_col(), dict_field_get_col(): Return const
dict_col_t*, so that changes to dict_col_t can be detected more
easily.  Add const to many dict_col_t* declarations.

dict_index_get_nth_type(): Replace with dict_index_get_nth_col().

dict_col_get_type(): Replace with dict_col_copy_type().

dict_col_get_min_size(), dict_col_get_max_size(), dict_col_get_fixed_size(),
dict_col_get_sql_null_size(): New functions.

dtype_get_at_most_n_mbchars(): Replace the parameter dtype
with the parameters prtype, mbminlen, mbmaxlen.

dtype_get_pad_char(), cmp_data_data(), cmp_data_data_slow(),
cmp_whole_field(): Replace the dtype_t* parameter with the ulint
parameters mtype, prtype.

dtype_copy(): Add a const qualifier to type2 (the one being copied from).

dtype_set_mblen(): Replaced with dtype_get_mblen().

dtype_get_fixed_size_low(), dtype_get_min_size_low(),
dtype_get_fixed_max_low(): Replace dtype_get_fixed_size(),
dtype_get_min_size(), and dtype_get_max_size().  These are used by the
dict_col_get_{fixed,min,max}_size() functions.

cmp_types_are_equal(): Replace with cmp_cols_are_equal().

dict_table_get_col_name(): Add a const qualifier parameter to the
parameter "table".

dtype_binary, dtype_binary_val: Remove.

dtype_is_fixed_size(): Remove.
2006-09-18 11:51:38 +00:00
marko
0b25b850b7 Tweak the bit-field definitions introduced since r813 to address Bug #20877.
rw_lock_t: Do not make writer_is_wait_ex a bit-field.  There are no fields
yet that could be fused to the same machine word, but we play it safe,
because the field writer_is_wait_ex may be modified by several threads
simultaneously.  Such fields should always be allocated an own machine
word.

dict_table_t: Change the type of all bit-fields to "unsigned".  Make
"space" a bit-field of 32 bits.  Move name_hash and id_hash after all
bit-fields, so that the bit-fields can be allocated together.  Do not
make autoinc_inited a bit-field, as we cannot allocate any field
from the same machine word.

dict_build_table_def_step(): Pass a local variable to
fil_create_new_single_table_tablespace() and initialize table->space
from it after the call, now that table->space is a bit-field.
2006-09-18 10:31:51 +00:00
marko
dc9107df2a Remove dict_tree_t, which should have been removed in r453.
There always was a one-to-one mapping between dict_tree_t and dict_index_t.

This saves 6 machine words per B-tree index in the data dictionary
cache plus the memory allocation overhead.  We save one mem_heap_t
object per index (15 machine words).  Considering the internal
fragmentation of the buddy allocator in mem_area_alloc(), this should
save 32 machine words per index (128 bytes on 32-bit systems and 256
bytes on 64-bit systems).  (Bug #20877)

struct dict_tree_struct, dict_tree_t: Remove.

struct dict_index_struct: Add page and lock.

dict_tree_create(): Remove.  Replace the invocation with
assignment to index->page and a call to rw_lock_create(&index->lock).

dict_tree_free(): Remove.  Replace the invocation wtih
a call to rw_lock_free(&index->lock).

dict_index_get_tree(): Remove.

dict_tree_get_space_reserve(): Rename to dict_index_get_space_reserve()
and remove the parameter, which was unused.

btr_level_list_remove(): Remove the unused parameter "tree".

Replace the occurrences of "tree" with "index" in names of variables,
functions and data types, e.g. "dict_tree_t tree" becomes
"dict_index_t index".  Remove local variables "tree" or "index" of
functions that needed both "tree" and "index".
2006-09-15 11:04:01 +00:00
marko
090d9d9dc6 dict_table_t: Rename the integer field max_row_size
to the Boolean field big_rows.  (Bug #20877)

BIG_ROW_SIZE: Move the definition from row0sel.c to dict_table_add_to_cache().
2006-09-14 12:06:43 +00:00
marko
3b49ab383b Remove dict_col_t::clust_pos.
dict_col_get_clust_pos(): Add parameter clust_index.  Replace the
look-up with a linear search of all columns in the clustered index.

row_upd_index_replace_new_col_vals(): Compute clust_index outside
the loops.  Compute clust_pos outside the inner loop.

row_upd_changes_ord_field_binary(), row_upd_changes_first_fields_binary():
Compute clust_index outside the loops.  Declare the auxiliary variables
inside the loop scope.
2006-09-14 11:51:34 +00:00
marko
f1cc5233f5 dict_col_t: Reduce ord_part to one bit.
dict_index_add_to_cache(): Instead of incrementing ord_part, set it.

dict_index_remove_from_cache(): Do not touch ord_part.

dtype_t: Reduce mbminlen from 3 to 2 bits.

row_upd(): Add a UNIV_LIKELY hint around node->in_mysql_interface.
2006-09-14 11:49:09 +00:00
marko
acd34bac47 Remove dict_col_t::hash, dict_col_t::table,
dict_sys->col_hash, and DICT_POOL_PER_COL_HASH.  (Bug #20877)

The col->table pointer was only needed for maintaining a hash table of
all defined columns in all tables.  The hash table was only looked up
in dict_index_find_cols().  Removing the col->hash and col->table
pointers reduces the size of a table column by two machine words
(usually 8 or 16 bytes).

dict_col_add_to_cache(), dict_col_reposition_in_cache(),
dict_col_remove_from_cache(): Remove.  These only updated dict_sys->col_hash.

dict_index_find_cols(): Use a linear search instead of the hash table.
The time complexity is affected, but this function is only invoked by
dict_index_add_to_cache(), and we only search the columns of a single
table (typically at most a few dozen) as opposed to all columns of all
tables.
2006-09-14 11:46:47 +00:00
marko
100aec2d16 dict_index_t: Remove tree_indexes. It should have been removed in r453
when the list in dict_tree_t was replaced with the pointer tree_index.
2006-09-13 18:41:13 +00:00
marko
1c1026ec0d Reduce the size of the data dictionary cache. (Bug #20877)
dtype_t: Remove unused field "prec", which was supposed to be used for
the precision of decimal columns in stand-alone InnoDB.

dtype_get_prec(): Remove.

dtype_set(), dict_mem_table_add_col(): Remove parameter "prec".

dtype_t: Turn all fields (mtype, prtype, len, mbminlen, mbmaxlen, len)
into bit-fields.

dict_table_t, dict_index_t, dict_tree_t: Omit magic_n from non-debug builds.

dict_col_t: Turn ind, clust_pos, and ord_part into bit-fields.

Replace the default clust_pos value ULINT_UNDEFINED with
REC_MAX_N_FIELDS and replace all references to clust_pos with calls to
the accessor function dict_col_get_clust_pos().

dict_field_t: Turn prefix_len and fixed_len into bit-fields.

dict_tree_t: Remove pad[64].

dict_table_t: Turn the fields ibd_file_missing, tablespace_discarded,
cached, flags, stat_initialized, and autoinc_inited into bit-fields.
Remove does_not_fit_in_memory from non-debug builds.

dict_index_t: Turn the fields trx_id_offset, n_user_defined_cols,
n_uniq, n_def, n_fields, n_nullable, and cached into bit-fields.

dict_foreign_struct: Turn n_fields and type into bit-fields.

rw_lock_t: Turn cline, last_s_line, and last_x_line into bit-fields.
Omit level unless #defined UNIV_SYNC_DEBUG.

Move REC_MAX_N_FIELDS (and REC_MAX_HEAP_NO and REC_MAX_N_OWNED)
from rem0rec.c to rem0types.h, as they are needed in dict0dict.ic.
dict_col_get_clust_pos(): Map REC_MAX_N_FIELDS to ULINT_UNDEFINED.
2006-09-12 14:06:46 +00:00
marko
33ed2aa4de Remove dict_col_t::aux, which was only used when copying an index definition
to the data dictionary cache.
2006-08-29 12:11:56 +00:00
osku
775b1c06a6 Add max_row_size to dict_table_t. 2006-05-26 05:52:59 +00:00
osku
032df406cb Remove remnants of the obsolete concept of memoryfixing tables and indexes.
Remove unused dict_table_LRU_trim().

Remove unused 'trx' parameter from the functions dict_table_get_on_id_low,
dict_table_get and dict_table_get_and_increment_handle_count.
2006-04-24 09:39:13 +00:00
marko
d8b5a3aff5 dict_table_t: Remove the field "type".
dict_load_table(): Refuse to load tables with other TYPE than
DICT_TABLE_ORDINARY.
2006-04-12 12:18:54 +00:00
osku
b6e02dd207 Fix bug #18934, "InnoDB crashes when table uses column names like
DB_ROW_ID", by refusing tables that use reserved column names.

Add dict_mem_table_free(), use it instead of duplicating the code everywhere.

Use already existing dict_mem_index_free().

Fix memory leaks in row_create_table_for_mysql() in rare corner cases.
2006-04-11 14:01:17 +00:00
marko
738611672f Remove code related to clustered tables. They were never implemented, and
the implementation would be challenging with ROW_FORMAT=COMPACT.

Remove the table types DICT_TABLE_CLUSTER_MEMBER and DICT_TABLE_CLUSTER and
all related tests and functions.

dict_table_t: Remove mix_id, mix_len, mix_id_len, mix_id_buf, and
cluster_name.

plan_t: Remove mixed_index.

dict_create_sys_tables_tuple(): Set MIX_ID=0, MIX_LEN=0 and CLUSTER_NAME=NULL
when inserting into SYS_TABLES.

dict_tree_check_search_tuple(): Enclose in #ifdef UNIV_DEBUG.
2006-04-11 12:51:34 +00:00
osku
1a8f28e6dd Remove "ibool comp" from dict_table_t and replace it with "ulint flags"
which can contain the new flag DICT_TF_COMPACT. Change dict_mem_table_create
to take a flags argument. Add dict_table_is_comp(). Adapt all users.

Change some places to explicitly assume that system tables do not use the
compact page format.
2006-02-27 09:11:57 +00:00
osku
ac69f8c21b Style cleanups: Convert spaces to tabs, remove trailing whitespace, other
misc cleanups.
2006-02-21 12:37:54 +00:00
osku
460042ef0d Remove the concept of "field order", as we will not support descending order
indexes.
2006-02-20 12:38:10 +00:00
marko
93a75f3e9a Remove the unused field fixed_offs from dict_field_t. 2006-02-07 13:08:46 +00:00
osku
2903c72469 Import 5.0 code. 2005-10-27 07:29:40 +00:00