Commit graph

149 commits

Author SHA1 Message Date
marko
f3cf33657c Minor cleanup.
ha_innobase::rnd_pos(): Use correct format in DBUG_PRINT statements.

buf_page_release(): Remove the local variable buf_fix_count.
2006-11-10 10:09:41 +00:00
marko
8631584cd9 Introduce #define UNIV_LIST_DEBUG for enabling the debug code in
UT_LIST_REMOVE_CLEAR().
2006-11-09 12:52:45 +00:00
marko
c3f7a6ebfc UT_LIST_REMOVE(): Invalidate the node pointers #ifdef UNIV_DEBUG.
buf_LRU_invalidate_tablespace(): Invoke UT_LIST_GET_PREV(LRU, block)
before UT_LIST_REMOVE(LRU, buf_pool->LRU, block).
2006-11-08 14:31:47 +00:00
marko
0dda8605fa Reduce buffer pool mutex contention under >= 4 big concurrent
CPU-bound SELECT queries.  (Bug #15815)

Fix: replace the mutex by one mutex protecting the 'flush list'
(and the free list) and several mutexes protecting portions of the
buffer pool, where we keep several indivudual LRU lists of pages.

This patch is from Sunny Bains and Heikki Tuuri.
2006-11-08 12:49:15 +00:00
marko
d260926abf 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
osku
cbf028490c 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
fd43c74b51 dict_print_info_on_foreign_key_in_create_format(): Use ut_print_name()
instead of passing the wrong length to ut_print_namel().  (Bug #23368)

ut_print_name(), ut_print_namel(): Document the special treatment of '/'.

ut_print_namel(): Replace strchr() with memchr(), as the string might
not be NUL-terminated.
2006-10-18 11:24:58 +00:00
marko
bb800d9c14 Send all SHOW ENGINE INNODB STATUS information to the client also when
UNIV_SYNC_DEBUG is defined.

rw_lock_list_print_info(): Add parameter "file".

mutex_list_print_info(): Add parameter "file".  Make the function static.
2006-10-12 10:26:25 +00:00
marko
8768878c09 Enclose some mem debug functions in #ifdef UNIV_DEBUG or #ifdef UNIV_MEM_DEBUG. 2006-10-10 08:27:08 +00:00
marko
6c6bc1f53e dict_index_get_if_in_cache(): Enclose in #ifdef UNIV_DEBUG.
Replace the search loop with a call to dict_index_find_on_id_low().
2006-10-09 11:47:02 +00:00
marko
e434f799f2 univ.i: Indent some of the directives, and remove conditions about Windows
in the "#else" branch of "#if building on Windows".
2006-10-06 19:51:33 +00:00
marko
e6c8f9fc5e mtr_print(), mtr_memo_contains(): Disable unless #ifdef UNIV_DEBUG. 2006-09-26 07:08:48 +00:00
osku
c345922067 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
bda1372743 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
osku
c9412da892 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
c6fd683e18 Change the recently introduced ulint bit-fields to unsigned. 2006-09-18 12:02:43 +00:00
marko
f39237e200 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
2d96f74a05 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
osku
53f8a9ff47 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
a78e211315 Add dict_col_get_clust_pos_noninline(), which was forgotten from r820. 2006-09-18 08:50:31 +00:00
marko
5f53f4b4f3 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
7696b8dd87 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
osku
b00733ad90 Make dict_index_find_cols() always succeed. 2006-09-15 07:37:10 +00:00
marko
0bedf4d9b4 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
adcb90a013 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
marko
b6540f6b72 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
9ac21cdea4 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
4a1c7668d2 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
e50acec9be 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
osku
18df0db041 btr0pcur.h: Change FIXME to TODO. 2006-09-14 09:19:41 +00:00
osku
8b68f259d9 Remove more remnants of mixed indexes. 2006-09-14 09:07:54 +00:00
marko
70b2db6a4e 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
0245fe4a31 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
63b8ede669 ibuf_entry_build(): Write prefix_len to the insert buffer instead of type->len
when prefix_len is specified.  Otherwise, btr_page_reorganize() during
insert buffer merge would fail on ROW_FORMAT=COMPACT tables.  (Bug #21638)
2006-09-05 11:43:42 +00:00
marko
5abd7f4e89 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
71cdd575f7 Merge changes from MySQL AB:
ChangeSet
  2006/08/23 13:59:16-07:00 brian@zim.(none) 
  This patch removes need for a innodb to have its own configure. 

univ.i: Replace ../ib_config.h with config.h.

Makefile.i, Makefile.am: Change directory paths.

configure.in: Delete.

plug.in: New file, included from the top-level configure.in.

setup.sh: Replace configure.in with plug.in.
2006-08-30 20:29:01 +00:00
marko
49f19b2df5 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
marko
cb19ec225e Split lines before binary operators, not after them. 2006-08-29 08:27:56 +00:00
marko
bf2ed0613e 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
e8435b3e45 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
ac53e5ead8 dfield_print_raw(): Make static. Print at most 1000 bytes to avoid
excessive space usage of the error log.
2006-08-17 12:46:19 +00:00
osku
34453e088c Remove all traces of the obsolete concept of replicate spaces. 2006-08-16 08:01:37 +00:00
osku
8452b0d43e btr_cur_get_page(): Remove buggy assertion. 2006-08-14 10:36:58 +00:00
marko
b689519f0b Merge a change from MySQL AB (originally implemented by Marko
in the 5.0 tree and now merged to the 5.1 tree):

# ChangeSet
#   2006/07/29 07:17:33+04:00 aivanov@mysql.com 
#   Make innodb_flush_log_at_trx_commit a settable global variable.
# 
# sql/ha_innodb.cc
#   2006/07/29 07:17:29+04:00 aivanov@mysql.com +1 -3
#   Remove innobase_flush_log_at_trx_commit
#   (set srv_flush_log_at_trx_commit directly).
# 
# sql/ha_innodb.h
#   2006/07/29 07:17:29+04:00 aivanov@mysql.com +1 -1
#   Remove innobase_flush_log_at_trx_commit.
#   Declare srv_flush_log_at_trx_commit.
# 
# storage/innobase/include/srv0srv.h
#   2006/07/29 07:17:30+04:00 aivanov@mysql.com +1 -1
#   Change the type of srv_flush_log_at_trx_commit.
# 
# storage/innobase/srv/srv0srv.c
#   2006/07/29 07:17:30+04:00 aivanov@mysql.com +1 -1
#   Change the type of srv_flush_log_at_trx_commit.
#
2006-08-11 08:05:40 +00:00
marko
2e10694fd1 Correct all URLs pointing to the MySQL manual. (Bug #21467) 2006-08-08 10:54:57 +00:00
marko
b5b3cb3184 Remove non-varying variable ibuf->meter and related constant IBUF_THRESHOLD. 2006-08-02 08:01:41 +00:00
marko
cb47e450b2 dtype_get_max_size(): Remove UNIV_INLINE qualifier, as the function is
defined inside a .c file rather than an .ic file.
2006-06-09 19:57:03 +00:00
marko
4858e1615e rw_lock_s_unlock_func(): Change a debug assertion to a production assertion
in order to track down Bug #19081.
2006-06-09 10:14:20 +00:00
osku
685dd69089 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
870edae7e4 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