Commit graph

88 commits

Author SHA1 Message Date
marko
134b1fda32 Lock the data dictionary during rollback. This removes the rare
debug assertion failure ut_ad(mutex_own(&(dict_sys->mutex))) in
dict_table_get_on_id() after the rollback following crash recovery.
2007-03-14 13:45:49 +00:00
marko
ed18169c68 Merge changes from MySQL AB:
ChangeSet@1.2452, 2007-02-23 13:13:55+02:00, monty@mysql.com +177 -0
  Fixed compiler warnings
  ...
  Fixed compiler warnings detected on windows64
2007-03-01 15:21:12 +00:00
marko
4c643e0e1a Merge r1239 from
branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG.
2007-01-18 21:27:31 +00:00
osku
76ad45ea9b Apply patch from MySQL:
ChangeSet@1.2353, 2006-12-19 16:57:51-07:00, tsmith@siva.hindu.god +13 -0
   Added innodb_rollback_on_timeout option to restore the 4.1 
   InnoDB timeout behavior (Bug #24200)
2007-01-11 11:45:58 +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
7fc2434c99 Unify dict_table_get_and_increment_handle_count() with dict_table_get() by
adding a second parameter, adjust callers.
2006-12-12 09:37:18 +00:00
marko
5f73dd4b2e Port r983 from branches/zip: Enclose some more debug code in
#ifdef UNIV_SYNC_DEBUG to allow the code to be built
with UNIV_DEBUG but without UNIV_SYNC_DEBUG.
2006-11-21 13:53:48 +00:00
marko
3b8ef8a822 Do not break the latching order in TRUNCATE TABLE.
dict_truncate_index_tree(): Replace parameter rec_t* rec with
btr_pcur_t* pcur.  Reposition pcur before calling btr_create().

sync_thread_add_level(): Remove the relaxation of the assertion added in r968.
2006-10-30 13:15:46 +00:00
marko
eba6d0713f row_purge_parse_undo_rec(): Correct a faulty condition. Luckily, this
bug would only surface if the InnoDB SQL interpreter were used for
updating fixed-length columns.  Currently (as the UPD_NODE_NO_SIZE_CHANGE
flag is never set), cmpl_info can only be 0 or UPD_NODE_NO_ORD_CHANGE.
Luckily, UPD_NODE_NO_ORD_CHANGE is 1, and the condition was simplified
to !cmpl_info.
2006-09-26 11:37:58 +00:00
marko
961aa8ea04 row_build_index_entry(): Declare variables in the beginning of a block,
to comply with ISO/IEC 9899:1989.  This error was made in r834.  (Bug #22575)
2006-09-22 06:48:56 +00:00
osku
e6ac06219e row_upd_sec_step(): Fix false comment. 2006-09-20 11:05:12 +00:00
osku
6819c897ae Split long lines with [] operators better. 2006-09-20 06:41:30 +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
osku
3729812895 Add dict_table_get_col_name() in preparation for getting rid of
dict_col_t::name, and use it instead of col->name everywhere.
2006-09-18 09:46:05 +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
sunny
d78ba5f3b7 row_search_for_mysql(): Skip setting the next-key lock on an already
delete-marked record in a clustered index where the search criteria is 
unique, within the same transaction (Bug #13544).
2006-09-15 06:09:20 +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
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
006e7c8830 On data tuples being updated or inserted (but not searched for),
set type->len to the prefix_len of the index column, if it is a prefix index.
This should prevent bugs similar to Bug #21638 from occurring.

dict_index_copy_types(): Set type->len to prefix_len if prefix_len != 0.

row_build_index_entry(): Set type->len to prefix_len if prefix_len != 0,
also when the column in the tuple is SQL NULL, because the type information
may be used for interpreting other records during btr_page_reorganize().
2006-09-06 09:23:47 +00:00
marko
279d526570 Remove unused code.
univ.i: Do not #define YYDEBUG, because it is only useful for debugging
the grammar of the Bison-generated InnoDB SQL parser.

row_build(): Remove type==ROW_COPY_ALSO_EXTERNALS, because it is never
passed.
2006-08-31 10:47:31 +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
marko
e87b68e001 row_vers_build_for_semi_consistent_read(): rec_trx_id was uninitialized
in a comparison.  Initialize it.
2006-08-14 11:18:18 +00:00
marko
2d45f76523 Merge code from MySQL:
ChangeSet@1.2181.173.1  2006-08-02 17:57:06+02:00  ingo@local

Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Changed back the encoded temp file prefix to #sql.
2006-08-14 07:34:26 +00:00
marko
b758497312 Correct all URLs pointing to the MySQL manual. (Bug #21467) 2006-08-08 10:54:57 +00:00
marko
e79ebe8315 After ut_print_timestamp(), always display " InnoDB:" (note two spaces). 2006-08-02 06:52:44 +00:00
marko
52c09c8c9c row_rename_table_for_mysql(): Restore the row_mysql_unlock_data_dictionary()
call that was accidentally removed in r674.
2006-07-31 11:05:14 +00:00
marko
cef9a0265f Remove the special treatment of tables
rsql_IDENTIFIER_recover_innodb_tmp_table, which is redundant and
was broken with the introduction of the "safe" file name encoding of
identifiers.  (Bug #21313)
2006-07-27 18:41:37 +00:00
osku
fb6d2015dc Revert r622 (innodb_sql table) as it was decided it's not appropriate for
the GPL InnoDB version.
2006-06-09 06:37:41 +00:00
osku
7f836357b5 Don't take unnecessary locks on supremum records when the
srv_locks_unsafe_for_binlog option is enabled. Fixes an assertion failure in
the innodb_unsafe_binlog testcase when compiled with UNIV_DEBUG.
2006-06-08 06:14:09 +00:00
osku
0049d987bc Add special 'innodb_sql' table that can be used to pass SQL commands to
InnoDB through MySQL.
2006-06-08 06:12:29 +00:00
osku
487da7028a Add support for lock waits in the SQL parser. 2006-06-08 06:08:23 +00:00
osku
124d970fcb Changes to InnoDB's SQL parser:
-Change default mode of SELECT from "lock in share mode" to "consistent
 read".

 -Remove support from SELECT for specifying "consistent read".

 -Add support in SELECT for specifying "lock in share mode".

 -Change all uses of SQL parser to specify "lock in share mode".
2006-05-31 05:34:18 +00:00
marko
90d0009b25 Merge r596 from branches/5.0: row_sel_try_search_shortcut(): Do not return
SEL_FOUND when the record was not found.  This bug was introduced in
MySQL/InnoDB 5.0.3, but luckily it should never manifest itself, given
that existing InnoDB SQL code never makes use of consistent reads.
2006-05-29 12:02:24 +00:00
osku
5adcddab31 Disable prefetch and adaptive hash index for tables with rows over 1024
bytes in InnoDB's SQL parser.
2006-05-26 11:01:39 +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
5fbd019220 Optimize BLOB selects by using prebuilt->blob_heap directly instead of first
reading BLOB data to a temporary heap and then copying it to
prebuilt->blob_heap.
2006-05-23 11:35:58 +00:00
osku
135e5219e0 Fetch externally stored fields when using InnoDB's internal SQL parser. 2006-05-23 05:49:17 +00:00
osku
f2651a69ba row_sel_store_mysql_rec(): Remove useless call to rec_get_nth_field
when handling an externally stored column.
2006-05-22 07:29:00 +00:00
osku
a6ce71b013 Move trx_commit_for_mysql(trx) calls in row0mysql.c before calls to
row_mysql_unlock_data_dictionary(trx), fixing bug #19727.
2006-05-12 11:13:18 +00:00
osku
32fa3568a3 row_fetch_print: Handle SQL NULL values without crashing. 2006-05-05 07:24:03 +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
osku
20694fdb8f Use bound literals in row_rename_table_for_mysql. 2006-04-17 08:14:04 +00:00
osku
177a588be9 Use bound literals in row_discard_tablespace_for_mysql. 2006-04-13 06:22:52 +00:00
osku
9f461c9082 Use bound literals in row_drop_table_for_mysql. 2006-04-12 18:17:47 +00:00