Commit graph

43 commits

Author SHA1 Message Date
vasil
30ee677a8f branches/5.1:
Merge r2294 from branches/5.0:

Fix typo and add comma in comment.
2008-02-11 15:51:03 +00:00
marko
3b705b44e4 When buffering an insert to a prefix index of a variable-length column,
do not incorrectly mark the column as fixed-length.  (Bug #28138)

ibuf_entry_build(): Instead of prefix_len, pass fixed_len to
dtype_new_store_for_order_and_null_size().  Add debug assertions.

btr_index_rec_validate(): Correct a comment about prefix indexes.

rec_get_converted_size_new(), rec_convert_dtuple_to_rec_new(): Add
debug assertions and comments.

dict_col_type_assert_equal(): New debug function.
2007-06-01 06:01:15 +00:00
marko
82b81a2987 Make InnoDB pluggable. That is, merge the modifications from MySQL WL#2936
and adapt some things.

Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
<mysql/plugin.h>.  Until the function is declared there, you can
uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.

Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
storage/innobase/Makefile.am and storage/innobase/plug.in.

plug.in: Declare InnoDB as a dynamic plugin.

ha_innodb.h: Remove the declarations of many global variables.  The variables
are no longer directly referenced outside of storage/innobase.

trx_t: Add the field trx->duplicates.

trx_create(): Initialize the fields trx->active_trans and trx->duplicates.

innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
2007-05-10 11:31:36 +00:00
marko
b0b266a9c6 Merge a change from MySQL AB:
ChangeSet@1.2372, 2006-12-31 02:29:11+01:00, kent@mysql.com +79 -0
  Many files:
    Removed "MySQL Finland AB & TCX DataKonsult AB" from copyright header
    Adjusted year(s) in copyright header 
    Added GPL copyright text
2007-01-11 09:36:27 +00:00
osku
4a8e394132 btr_lift_page_up(): Set new page levels in all ancestor pages, not just
in the father page.

btr0btr.h: Add a BTR_MAX_LEVELS define.
2006-10-19 10:43:14 +00:00
marko
e8b18d9e7f btr_page_get_father_for_rec(): Remove bogus comment about removed dict_tree_t. 2006-10-16 07:29:59 +00:00
osku
a2a7c6cab5 Revamp the line splits done in r763 and r764 that can now be done better,
thanks to r826.
2006-09-19 07:22:21 +00:00
marko
0d298ea513 page_offset(): New function to replace many ut_align_offset(., UNIV_PAGE_SIZE)
calls.

dict_index_build_node_ptr(): Correct a typo in a comment.
2006-09-19 05:55:10 +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
96ac3d46a7 page_align(ptr): New utility function to replace
ut_align_down(ptr, UNIV_PAGE_SIZE) calls.
2006-09-18 07:14:41 +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
0efd5d663e Reduce the size of btr_search_t from 13 machine words to 7. This
structure is reserved for every index in the data dictionary cache.
(Bug #20877)

We could shrink the structure further to three 32-bit words or two
64-bit words by turning the remaining fields to bit-fields.
Unfortunately, the fields are not protected by any mutex, and thus we
would better keep each field aligned to a machine word.

btr_search_t, buf_block_t: Rename "ulint side" to "ibool left_side".
Remove BTR_SEARCH_LEFT_SIDE and BTR_SEARCH_RIGHT_SIDE, and also rename
some local variables and function parameters from "ulint side" to
"ibool left_side".

btr_search_t: Remove the unused fields last_search, n_direction, direction,
and modify_clock.  Remove the unused constants BTR_SEA_NO_DIRECTION,
BTR_SEA_LEFT, BTR_SEA_RIGHT, and BTR_SEA_SAME_REC.

btr_search_t: Remove magic_n unless #defined UNIV_DEBUG.  Turn an assertion
about the magic number into a debug assertion.
2006-09-14 20:42:46 +00:00
marko
0e79b32012 Minor cleanup related to Bug #20877.
btr_print_recursive(): Replace tree->tree_indexes with tree->index.
This should have been done in r453.

univ.i: Add UNIV_BTR_PRINT.

rw_lock_t: Reduce writer_is_wait_ex to a bit and move it close to
other bitfields.  Change the types to unsigned, in case ulint or ibool
bitfields will not work.
2006-09-14 20:37:15 +00:00
osku
e06fb85900 Remove more remnants of mixed indexes. 2006-09-14 09:07:54 +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
27dffa4f7d Split lines before binary operators, not after them. 2006-08-29 08:27:56 +00:00
marko
917941e44c Split lines before an opening parenthesis, not after one.
Replace some printf(...) in debug builds with fprintf(stderr, ...).
2006-08-29 07:33:51 +00:00
marko
8f18616ef0 Reindent the code base (except for ha_innodb.{cc,h} and generated parser
and lexer files).  From now on, the following Emacs cc-mode settings apply
when indenting C function bodies in InnoDB:

(setq c-basic-offset 8)
(setq c-label-minimum-indentation 0)
(add-to-list 'c-offsets-alist '(c . 0))
(add-to-list 'c-offsets-alist '(label . [0]))

The indentation rules for function declarations still have not been
formalized, and they must be formatted manually.

Try to limit all lines to at most 79 characters (assuming TAB stops every
8 characters) by splitting lines before opening parenthesis, or at
string constants.

Fix some grammar mistakes in diagnostic output:
 match to, match with -> match
 found from -> found in
 trying rename -> trying to rename

Fix an error in page_check_dir(): it said "supremum not pointed to"
when the infimum was not pointed to.

Enclose commented-out code snippets in #if 0 ... #endif instead of /* ... */.
Add (void*) casts to some %p parameters in fprintf() calls.  Try to
split lines before a binary operator, not after one.  (These three fixes
were not made everywhere.)
2006-08-28 17:42:45 +00:00
osku
66241d5a8d btr_cur_search_to_nth_level(): Document where cursor is left at in
PAGE_CUR_LE searches.

page_validate(): Add missing space to error print.
2006-08-28 06:15:42 +00:00
marko
b758497312 Correct all URLs pointing to the MySQL manual. (Bug #21467) 2006-08-08 10:54:57 +00:00
marko
a3daffde6a btr_cur_search_to_nth_level(): Reacquire btr_search_latch after inserting
to the insert buffer.  This was noticed while analyzing Bug #19081, but
this should not fix Bug #19081, since according to Heikki, btr_search_latch
is not reserved during an insert.
2006-06-09 19:54:58 +00:00
marko
85ccc78fe3 Adapt InnoDB to the new tablename to filename encoding in MySQL 5.1.
ut_print_name(), ut_print_namel(): Add parameter table_id for distinguishing
names of tables from other identifiers (names of indexes, columns and
constraints).

innobase_convert_from_table_id(), innobase_convert_from_id(),
innobase_convert_from_filename(), innobase_get_charset(): New functions.

dict_accept(), dict_scan_id(), dict_scan_col(), dict_scan_table_name(),
dict_skip_word(), dict_create_foreign_constraints_low():
Add parameter "cs", so that isspace() can be replaced with my_isspace(),
whose operation depends on the connection character set.

dict_scan_id(): Convert the identifier to UTF-8.

dict_str_starts_with_keyword(): New extern function, to replace dict_accept()
in row_search_for_mysql().

mysql_get_identifier_quote_char(): Replaced with innobase_print_identifier().

ha_innobase::create(): Remove the thd->convert_string() call.
Pass the statement to InnoDB in the connection character set
and let InnoDB convert the identifiers to UTF-8.
2006-05-24 10:27:17 +00:00
osku
83ed919c45 btr_copy_externally_stored_field(): Only set the 'offset' variable when
needed.
2006-05-22 07:50:05 +00:00
marko
5ba4fc828a Define UNIV_BTR_DEBUG for enabling consistency checks of
FIL_PAGE_NEXT and FIL_PAGE_PREV when accessing sibling pages
of B-tree indexes.

btr_validate_level(): Check the validity of the doubly linked list
formed by FIL_PAGE_NEXT and FIL_PAGE_PREV.
2006-05-11 16:59:18 +00:00
osku
5737acba07 Add 'level' parameter to rw_lock_create(), remove rw_lock_set_level(). 2006-04-28 05:49:59 +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
marko
09ba6e648b Disable the statistics variables btr_search_n_hash_fail and
n_hash_succ, n_hash_fail, n_patt_succ, and n_searches of btr_search_t
in builds without #ifdef UNIV_SEARCH_PERF_STAT.
2006-04-03 11:28:43 +00:00
marko
43a21f6ed4 Merge r328:340 from branches/5.0:
r340: Fix http://bugs.mysql.com/bug.php?id=18283 in ha_innodb.cc and
http://bugs.mysql.com/bug.php?id=18238 in InnoDB

r339: Remove disk space leak on update of BLOB columns (Bug #18252).

btr_cur_pessimistic_update(): Invoke rec_get_offsets() after
rec_set_field_extern_bits().

btr_store_big_rec_extern_fields(): Note that offsets will no longer be
valid after calling this function.

r338: Fix bug 18238 : check in pessimistic insert and update if the buffer
pool is exhausted by locks
2006-03-17 08:20:14 +00:00
osku
fc82d3349e Fix compilation problem with non-C99 compilers in btr0sea.c. 2006-03-14 07:58:35 +00:00
marko
a7af1d399b Replace buf_block_align(btr_cur_get_page()) with
buf_block_align(btr_cur_get_rec()).
2006-03-10 14:41:44 +00:00
osku
7340e52d1f Port parts of r297 from branches/fts:
row_upd_index_replace_new_col_vals_index_pos(): Add a parameter, "ibool
order_only", for limiting the replacement to the ordering fields of the
index. Adjust callers.

 In this port, the comment for the parameter was adjusted to make it clear
 that it only supports clustered indexes.
2006-03-10 11:06:33 +00:00
osku
243e54a1f3 Remove two redundant casts from calls to ut_print_buf. 2006-03-06 12:51:50 +00:00
osku
52d2051e95 Change ut_print_buf() and mem_analyze_corruption() to take a void*, not a
byte*. Remove redundant casts from callers.
2006-03-06 09:45:04 +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
marko
9596f6d82d Merge r102 from hotbackup/trunk.
Corrected some comments.

os_file_create_tmpfile(): Remove the implementation from InnoDB Hot Backup.

In InnoDB Hot Backup builds, do not define dict_casedn_str(),
which is invoked in fil_load_single_table_tablespace() on
Windows.  This function depends on innobase_casedn_str() and
my_casedn_str().

Define btr_check_node_ptr() and data_error only #ifdef UNIV_DEBUG.
They are only being used in ut_ad() assertions.

Replace the occurrences of the type uint with ulint, because InnoDB
Hot Backup does not define any uint data type.

Disable lock_validate() in InnoDB Hot Backup builds.

Disable some unused static variables of srv0srv.c in InnoDB Hot Backup builds.

Disable some srv_table_...() functions in InnoDB Hot Backup builds.

Disable some unused static variables in srv0start.c in
InnoDB Hot Backup builds.

Disable io_handler_thread() in InnoDB Hot Backup builds.

Disable srv_calc_low32() and srv_calc_high32() in InnoDB Hot Backup builds
to avoid warnings about unused functions.

In fil_node_open_file(), avoid bogus assertions in InnoDB Hot Backup builds.

In fil_load_single_table_tablespace(), remove the call to dict_casedn_str(),
as it depends on MySQL code.

Copy the code of recv_reset_log_files_for_backup() from InnoDB Hot Backup.

Disable innobase_mysql_cmp(), cmp_whole_field(), cmp_data_data_slow(),
cmp_dtuple_rec_with_match() and cmp_rec_rec_with_match()
in InnoDB Hot Backup builds, as they depend on MySQL code.

Adapt dtype_set_mblen() and dtype_get_fixed_size() for InnoDB Hot Backup
builds, assuming that they will only be called on system tables, which
do not contain multi-byte characters.

Disable the static functions row_ins_set_exclusive_rec_lock() and
row_ins_dupl_error_with_rec() in InnoDB Hot Backup builds
to avoid warnings about unused functions.

In row_sel_field_store_in_mysql_format(), disable some UTF-8 related
assertions #ifndef UNIV_RELEASE_NOT_YET_STABLE.
2006-02-21 08:43:31 +00:00
marko
3313036110 Set FIL_PAGE_TYPE for every page, so that the field can be relied on in
new tablespaces created from now on.

btr_store_big_rec_extern_fields(): Set FIL_PAGE_TYPE to FIL_PAGE_TYPE_BLOB.

buf_page_print(): Decode FIL_PAGE_TYPE.  Replace if-else with switch().

buf_page_create(): Set FIL_PAGE_PREV, FIL_PAGE_NEXT and FIL_PAGE_TYPE.

trx_sysf_create(): Set FIL_PAGE_TYPE to FIL_PAGE_TYPE_TRX_SYS.
Initialize TRX_SYS_RSEG_SPACE.

FIL_PAGE_TYPE: Document that the field cannot be relied on in older
versions of MySQL/InnoDB.  Add new type codes.

ibuf_bitmap_page_init(): Document that the rest of the page is uninitialized.

ibuf_add_free_page(): Log the setting of FIL_PAGE_TYPE.

fsp_header_init(): Set FIL_PAGE_TYPE to FIL_PAGE_TYPE_FSP_HDR.
Initialize FSP_NOT_USED.

fsp_fill_free_list(): Set FIL_PAGE_TYPE to FIL_PAGE_TYPE_XDES.

fsp_alloc_seg_inode_page(): Set FIL_PAGE_TYPE to FIL_PAGE_INODE.

fseg_create_general(): Set FIL_PAGE_TYPE to FIL_PAGE_TYPE_SYS.
2006-02-20 15:42:49 +00:00
osku
44a14a1791 Fix all function declarations to have the correct number of '=' characters. 2006-02-20 12:12:22 +00:00
osku
3d98fd8b2a Port r172 from branches/5.0:
Fix bug #17126, CHECK TABLE blocking other queries, by releasing the
btr_search_latch periodically during the adaptive hash table validation.
2006-02-09 15:44:27 +00:00
marko
65caba82a4 Port r152 from branches/5.0: Account for a race condition when dropping the
adaptive hash index for a B-tree page.  (Bug #16582)

btr_search_drop_page_hash_index(): Retry the operation if a hash index
with different parameters was built meanwhile.  Add diagnostics for the
case that hash node pointers to the page remain.  This fix is from Heikki.

btr_search_info_update_hash(), btr_search_info_update_slow():
Document the parameter "info" as in/out.
2006-01-24 12:13:44 +00:00
marko
05392a9d8a Port r53 from branches/5.0:
Make comments about buf_block_t::index more accurate.
2005-11-17 09:00:25 +00:00
marko
96cccd1538 Merge patch to MySQL/InnoDB 5.0: Fix Bug #14747.
Note that buf_block_t::index should be protected by btr_search_latch
or an s-latch or x-latch on the index page.
btr_search_drop_page_hash_index(): Read block->index while holding
btr_search_latch and use the cached value in the loop.  Remove some
redundant assertions.
2005-11-16 15:10:37 +00:00
osku
2903c72469 Import 5.0 code. 2005-10-27 07:29:40 +00:00