Commit graph

646 commits

Author SHA1 Message Date
vasil
f2e8426752 branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal

[Step 15/28]
2009-02-17 09:29:55 +00:00
vasil
13d548f932 branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal

[Step 13/28]
2009-02-17 09:27:31 +00:00
vasil
a12c1a05e5 branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal

[Step 13/28]
2009-02-17 09:24:40 +00:00
vasil
ea68867dd7 branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal

[Step 12/28]
2009-02-17 09:18:35 +00:00
vasil
3a5070562f branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal

[Step 11/28]
2009-02-17 09:14:40 +00:00
vasil
156ed23fe1 branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal

[Step 10/28]
2009-02-17 09:12:41 +00:00
vasil
52f0c662d2 branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal

[Step 9/28]
2009-02-17 09:10:18 +00:00
vasil
98af6f74d5 branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal

[Step 8/28]
2009-02-17 09:06:49 +00:00
vasil
cb7c66d0d2 branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal

[Step 7/28]
2009-02-17 09:04:28 +00:00
vasil
54d835ad05 branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal

[Step 6/28]
2009-02-17 09:02:27 +00:00
vasil
d8aa953d08 branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal

[Step 5/28]
2009-02-17 08:59:22 +00:00
vasil
7736c6fe08 branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal

[Step 4/28]
2009-02-17 08:55:41 +00:00
vasil
c6232c06fa branches/zip:
To the files touched by the Google patch from c4144 (excluding
include/os0sync.ic because later we removed Google code from that file):

* Remove the Google license
* Remove old Innobase copyright lines
* Add a reference to the Google license and to the GPLv2 license at the top,
as recommended by the lawyers at Oracle Legal.
2009-02-17 07:56:33 +00:00
vasil
3c6d991778 branches/zip:
(followup to r4145) Non-functional change:

Change the os_atomic_increment() and os_compare_and_swap() functions
to macros to avoid artificial limitations on the types of those
functions' arguments. As a consequence typecasts from the source
code can be removed.

Also remove Google's copyright from os0sync.ic because that file no longer
contains code from Google.

Approved by:	Marko (rb://88), also ok from Inaam via IM
2009-02-10 20:58:17 +00:00
inaam
a1bb700fd2 branches/zip rb://30
This patch changes the innodb mutexes and rw_locks implementation.
On supported platforms it uses GCC builtin atomics. These changes
are based on the patch sent by Mark Callaghan of Google under BSD
license. More technical discussion can be found at rb://30

Approved by: Heikki
2009-02-09 23:36:25 +00:00
marko
e97b5d3e3a branches/zip: Enclose some backup functions in #ifdef UNIV_HOTBACKUP.
recv_read_cp_info_for_backup(), recv_scan_log_seg_for_backup():
These functions are only called by InnoDB Hot Backup.
2009-02-02 12:28:17 +00:00
marko
11d57d9369 branches/zip: innobase_start_or_create_for_mysql(): Remove a factual error
in the function comment.  Parameters are not read from a file "srv_init".
2009-02-02 08:48:05 +00:00
marko
6aab391620 branches/zip: Make innodb_adaptive_hash_index settable.
btr_search_disabled: Rename to btr_search_enabled and change the type
to char, so that it can be directly linked to the MySQL parameters.
Note that the variable is protected by btr_search_latch and
btr_search_enabled_mutex, a new mutex introduced in this patch.

btr_search_enabled_mutex: A new mutex, to protect btr_search_enabled
together with btr_search_latch.

buf_pool_drop_hash_index(): New function, to be called from
btr_search_disable().

btr_search_disable(), btr_search_enable(): Fix bugs.  These functions
were previously unused.

btr_search_guess_on_hash(), btr_search_build_page_hash_index():
Check btr_search_enabled once more, while holding btr_search_latch.

btr_cur_search_to_nth_level(): Note that the reads of btr_search_enabled
may be dirty and explain why it should not be a problem.

innobase_adaptive_hash_index: Remove. The variable btr_search_enabled will be used directly instead.

innodb_adaptive_hash_index_update(): New function, an update callback for
innodb_adaptive_hash_index.  This will call either btr_search_disable()
or btr_search_enable() when the value is assigned.  The functions will
be called even if the value does not appear to be changed, e.g., when
setting from TRUE to TRUE or FALSE to FALSE.

rb://85 approved by Heikki Tuuri.  This addresses Issue #163.
2009-01-30 21:30:29 +00:00
marko
635268b769 branches/zip: ibuf_use_t: Add the constant IBUF_USE_COUNT, to eliminate
a gcc warning about an assertion that trivially holds.
The warning was introduced in r4061, in the merge of
branches/innodb+ -r4053.

ibuf_insert(): Let an assertion fail if ibuf_use is unknown.
2009-01-30 10:58:56 +00:00
marko
8b025adba6 branches/zip: Port the applicable parts of r4053 from branches/innodb+:
Implement the global variable innodb_change_buffering, with the
following values:

none - buffer nothing
inserts - buffer inserts (the default)

Approved by Ken Jacobs.
2009-01-29 09:27:09 +00:00
marko
15b9f877ec branches/zip: Enclose some functions inside #ifdef UNIV_HOTBACKUP:
ut_sprintf_timestamp_without_extra_chars(), ut_get_year_month_day(),
log_reset_first_header_and_checkpoint(): These functions are only used
in InnoDB Hot Backup.
2009-01-28 13:21:45 +00:00
marko
0f8dcc7cb7 branches/zip: trx0sys.ic: Remove unnecessary #include <data0type.h>. 2009-01-28 12:35:49 +00:00
marko
0a2e4aa324 branches/zip: Revert the change to univ.i that was accidentally
committed in r4045.
2009-01-27 22:33:20 +00:00
marko
938c8ee6b7 branches/zip: btr_search_validate(): Fix a bogus UNIV_DEBUG
assertion failure that was accidentally introduced in r4036.
Instead of calling buf_block_get_frame(), which asserts that the
block must be buffer-fixed, access block->frame directly.  That
is safe, because changes of block->page.state are protected by
the buffer pool mutex, which we are holding.

This bug was reported by Michael.
2009-01-27 22:31:17 +00:00
marko
b707b2e3b1 branches/zip: In r988, the function buf_block_align() was enclosed
within UNIV_DEBUG. The two remaining callers in non-debug builds,
btr_search_guess_on_hash() and btr_search_validate(), were rewritten
to call buf_page_hash_get().

To implement support for a resizeable buffer pool, the function
buf_block_align() had been rewritten to perform a page hash lookup in
the buffer pool. The caller was also made responsible for holding the
buffer pool mutex.

Because the page hash lookup is expensive and it has to be done while
holding the buffer pool mutex, implement buf_block_align() by pointer
arithmetics again, and make btr_search_guess_on_hash() call it. Note
that this will have to be adjusted if the interface to the resizeable
buffer pool is actually implemented.

rb://83 approved by Heikki Tuuri, to address Issue #161.

As a deviation from the approved patch, this patch also makes
btr_search_validate() (invoked by CHECK TABLE) check that
buf_pool->page_hash is consistent with buf_block_align().
2009-01-26 20:33:20 +00:00
marko
5dceabc908 branches/zip: buf_page_get_gen(): Remove the unused mode BUF_GET_NOWAIT.
This was noticed while investigating Issue #160.
2009-01-23 13:31:36 +00:00
marko
0bd67bdba1 branches/zip: Remove some redundant #include directives. 2009-01-23 12:07:38 +00:00
marko
70ca1bee38 branches/zip: Enclose some more unused code in #ifdef UNIV_LOG_ARCHIVE.
This will help trim the dependencies of InnoDB Hot Backup.

recv_recovery_from_checkpoint_start(): Rename to
recv_recovery_from_checkpoint_start_func(), and remove the two first
parameters unless UNIV_LOG_ARCHIVE is defined.  Define and use
the auxiliary macros TYPE_CHECKPOINT and LIMIT_LSN in the function.

struct recv_sys_struct: Remove archive_group unless UNIV_LOG_ARCHIVE
is defined.

Do not define LOG_ARCHIVE unless UNIV_LOG_ARCHIVE is defined.
2009-01-23 09:26:10 +00:00
marko
bef98e3442 branches/zip: Remove some redundant #include statements. 2009-01-23 09:04:49 +00:00
marko
7944c2cac9 branches/zip: Merge revisions 3930:4005 from branches/5.1:
------------------------------------------------------------------------
  r4004 | marko | 2009-01-20 16:19:00 +0200 (Tue, 20 Jan 2009) | 12 lines

  branches/5.1: Merge r4003 from branches/5.0:

  rec_set_nth_field(): When the field already is SQL null,
  do nothing when it is being changed to SQL null. (Bug #41571)

  Normally, MySQL does not pass "do-nothing" updates to the storage engine.
  When it does and a column of an InnoDB table that is in ROW_FORMAT=COMPACT
  is being updated from NULL to NULL, the InnoDB buffer pool will be corrupted
  without this fix.

  rb://81 approved by Heikki Tuuri
  ------------------------------------------------------------------------
  r4005 | marko | 2009-01-20 16:22:36 +0200 (Tue, 20 Jan 2009) | 8 lines

  branches/5.1: lock_is_table_exclusive(): Acquire kernel_mutex before
  accessing table->locks and release kernel_mutex before returning from
  the function.  This fixes a portential race condition in the
  "commit every 10,000 rows" in ALTER TABLE, CREATE INDEX, DROP INDEX,
  and OPTIMIZE TABLE. (Bug #42152)

  rb://80 approved by Heikki Tuuri
  ------------------------------------------------------------------------
2009-01-20 14:29:22 +00:00
marko
2341d537a4 branches/zip: Merge revisions 3601:3930 from branches/5.1:
------------------------------------------------------------------------
  r3911 | sunny | 2009-01-13 14:15:24 +0200 (Tue, 13 Jan 2009) | 13 lines

  branches/5.1: Fix Bug#38187 Error 153 when creating savepoints
  InnoDB previously treated savepoints as a stack e.g.,
    SAVEPOINT a;
    SAVEPOINT b;
    SAVEPOINT c;
    SAVEPOINT b; <- This would delete b and c.

  This fix changes the behavior to:
    SAVEPOINT a;
    SAVEPOINT b;
    SAVEPOINT c;
    SAVEPOINT b; <- Does not delete savepoint c
  ------------------------------------------------------------------------
  r3930 | marko | 2009-01-14 15:51:30 +0200 (Wed, 14 Jan 2009) | 4 lines

  branches/5.1: dict_load_table(): If dict_load_indexes() fails,
  invoke dict_table_remove_from_cache() instead of dict_mem_table_free(),
  so that the data dictionary will not point to freed data.
  (Bug #42075, Issue #153, rb://76 approved by Heikki Tuuri)
  ------------------------------------------------------------------------
2009-01-14 14:06:22 +00:00
marko
2f7bcc7d99 branches/zip: In hash table lookups, assert that the traversed items
satisfy some conditions when UNIV_DEBUG is defined.

HASH_SEARCH(): New parameter: ASSERTION. All users will pass an appropriate
ut_ad() or nothing.

dict_table_add_to_columns(): Assert that the table being added to the data
dictionary cache is not already being pointed to by the name_hash and
id_hash tables.

HASH_SEARCH_ALL(): New macro, for use in dict_table_add_to_columns().

dict_mem_table_free(): Set ut_d(table->cached = FALSE), so that we can
check ut_ad(table->cached) when traversing the hash tables, as in
HASH_SEARCH(name_hash, dict_sys->table_hash, ...) and
HASH_SEARCH(id_hash, dict_sys->table_id_hash, ...).

dict_table_get_low(), dict_table_get_on_id_low(): Assert
ut_ad(!table || table->cached).

fil_space_get_by_id(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(hash, fil_system->spaces, ...).

fil_space_get_by_name(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(name_hash, fil_system->name_hash, ...).

buf_buddy_block_free(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->zip_hash, ...).

buf_page_hash_get(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->page_hash, ...).

get_share(), free_share(): Check ut_ad(share->use_count > 0) in
HASH_SEARCH(table_name_hash, innobase_open_tables, ...).

This was posted as rb://75 for tracking down errors similar to Issue #153.
2009-01-13 19:46:22 +00:00
marko
108ac96cdb branches/zip: Enable HASH_ASSERT_OWNED independently of UNIV_SYNC_DEBUG. 2009-01-13 10:34:32 +00:00
marko
3b6075651d branches/zip: Non-functional change: Add some debug assertions and comments.
buf_page_t: Note that the LRU fields are protected by buf_pool_mutex
only, not block->mutex or buf_pool_zip_mutex.

buf_page_get_freed_page_clock(): Note that this is sometimes invoked
without mutex protection.

buf_pool_get_oldest_modification(): Note that the result may be out of
date.

buf_page_get_LRU_position(), buf_page_is_old(): Assert that the buffer
pool mutex is being held.

buf_page_release(): Assert that dirty blocks are in the flush list.
2009-01-12 16:56:11 +00:00
marko
b2d9b59be3 branches/zip: struct mtr_struct: Remove the unused field magic_n
unless UNIV_DEBUG is defined.  mtr->magic_n is only assigned to
and checked in UNIV_DEBUG builds.
2009-01-12 12:40:08 +00:00
marko
5b08c7322e branches/zip: buf_page_get_newest_modification(): Use the block mutex
instead of the buffer pool mutex.  This is related to Issue #157.
2009-01-12 12:25:22 +00:00
marko
179e75c559 branches/zip: Some non-functional changes related to Issue #155.
buf_page_struct: Note that space and offset are also protected by
buf_pool_mutex.  They are only assigned to by
buf_block_set_file_page().  Thus, it suffices for buf_flush_batch() to
hold just buf_pool_mutex when checking these fields.

buf_flush_try_page(): Rename "locked" to "is_s_latched", per Heikki's request.

buf_flush_batch(): Move the common statement mutex_exit(block_mutex)
from all if-else if-else branches before the if block.  Remove the
redundant test (buf_pool->init_flush[flush_type] == FALSE) that was
apparently copied from buf_flush_write_complete().

buf_flush_write_block_low(): Note why it is safe not to hold buf_pool_mutex
or block_mutex.  Enumerate the assumptions in debug assertions.
2009-01-09 20:27:40 +00:00
marko
6b0531d6e6 branches/zip: buf_flush_insert_into_flush_list(),
buf_flush_insert_sorted_into_flush_list(): Remove unused code.
Change the parameter to buf_block_t* block and assert that
block->state == BUF_BLOCK_FILE_PAGE.  This is part of Issue #155.
2009-01-09 13:40:11 +00:00
inaam
09a089ecf8 branches/zip: Implement the parameter innodb_use_sys_malloc
(false by default), for disabling InnoDB's internal memory allocator
and using system malloc/free instead.

rb://62 approved by Marko
2009-01-02 13:10:50 +00:00
marko
d1b5613fa0 branches/zip: Merge revisions 3479:3598 from branches/5.1:
------------------------------------------------------------------------
  r3588 | inaam | 2008-12-18 14:26:54 +0200 (Thu, 18 Dec 2008) | 8 lines

  branches/5.1

  It is a bug in unused code. If we don't calculate the hash value when
  calculating the mutex number then two pages which map to same hash
  value can get two different mutex numbers.

  Approved by: Marko
  ------------------------------------------------------------------------
  r3590 | marko | 2008-12-18 15:33:36 +0200 (Thu, 18 Dec 2008) | 11 lines

  branches/5.1: When converting a record to MySQL format, copy the default
  column values for columns that are SQL NULL.  This addresses failures in
  row-based replication (Bug #39648).

  row_prebuilt_t: Add default_rec, for the default values of the columns in
  MySQL format.

  row_sel_store_mysql_rec(): Use prebuilt->default_rec instead of
  padding columns.

  rb://64 approved by Heikki Tuuri
  ------------------------------------------------------------------------
  r3598 | marko | 2008-12-22 15:28:03 +0200 (Mon, 22 Dec 2008) | 6 lines

  branches/5.1: ibuf_delete_rec(): When the record cannot be found and
  the tablespace has been dropped, commit the mini-transaction, so that
  InnoDB will not hold the insert buffer tree latch in exclusive mode,
  causing a potential deadlock.  This bug was introduced in the fix of
  Bug #27276 in r2924.
  ------------------------------------------------------------------------
2008-12-22 13:41:47 +00:00
marko
5697b755e6 branches/zip: Pass the caller's file name and line number to
row_mysql_lock_data_dictionary(), row_mysql_freeze_data_dictionary(),
to better track down locking issues that involve dict_operation_lock.
2008-12-22 10:27:16 +00:00
marko
0cb2a737fd branches/zip: HASH_INSERT, HASH_DELETE: Add explicit type conversions,
so that the macros will expand to valid C++.  Unlike C++, C allows
implicit type conversions from void* to other pointer types.
2008-12-19 11:58:13 +00:00
marko
4856b4ba61 branches/zip: Remove update-in-place-in-select from the internal SQL
interpreter.  It was only used for updating the InnoDB internal data
dictionary when renaming or dropping tables.  It could have caused
deadlocks after acquiring latches on insert buffer bitmap pages.
This and r3544 should fix Issue #135.

Furthermore, the update-in-place-in-select does not account for
compression failure.  That was not a problem yet, since the InnoDB SQL
interpreter has so far assumed ROW_FORMAT=REDUNDANT.

rb://63 approved by Heikki Tuuri
2008-12-17 12:40:59 +00:00
marko
b0ab87862c branches/zip: Introduce UNIV_AHI_DEBUG for debugging the adaptive hash
index without enabling UNIV_DEBUG.
2008-12-17 09:19:56 +00:00
marko
ba65432056 branches/zip: btr_cur_optimistic_delete(): Note that no further pages
must be latched before calling mtr_commit(mtr) if the function returns TRUE.
2008-12-16 10:14:58 +00:00
marko
d32ffdd1a3 branches/zip: Clean up the insert buffer subsystem.
Originally, there were provisions in InnoDB for multiple insert buffer
B-trees, apparently one for each tablespace.

When Heikki implemented innodb_file_per_table (multiple InnoDB
tablespaces) in MySQL 4.1, he made the insert buffer live only in the
system tablespace (space 0) but left the provisions in the code.

When Osku Salerma implemented delete buffering, he also cleaned up the
insert buffer subsystem so that only one insert buffer B-tree exists.
This patch applies the clean-up to the InnoDB Plugin.

Having a separate patch of the insert buffer clean-up should help us
better compare the essential changes of the InnoDB Plugin and InnoDB+
and to track down bugs that are specific to InnoDB+.

IBUF_SPACE_ID: New constant, defined as 0.

ibuf_data_t: Remove.

ibuf_t: Add the applicable fields from ibuf_data_t.  There is only one
insert buffer tree from now on.

ibuf_page_low(), ibuf_page(): Merge to a single function ibuf_page().

fil_space_t: Remove ibuf_data.

fil_space_get_ibuf_data(): Remove.  There is only one ibuf_data, for
space IBUF_SPACE_ID.

fil_ibuf_init_at_db_start(): Remove.

ibuf_init_at_db_start(): Fuse with ibuf_data_init_for_space().

ibuf_validate_low(): Remove.  There is only one ibuf tree.

ibuf_free_excess_pages(), ibuf_header_page_get(),
ibuf_free_excess_pages(): Remove the parameter space, which was always
0.

ibuf_tree_root_get(): Remove the parameters space and data.  There is
only one ibuf tree, for space IBUF_SPACE_ID.

ibuf_data_sizes_update(): Rename to ibuf_size_update(), and remove the
parameter data.  There is only one ibuf data struct.

ibuf_build_entry_pre_4_1_x(): New function, refactored from
ibuf_build_entry_from_ibuf_rec().

ibuf_data_enough_free_for_insert(), ibuf_data_too_much_free(): Remove
the parameter data.  There is only one insert buffer tree.

ibuf_add_free_page(), ibuf_remove_free_page(): Remove the parameters
space and data.  There is only one insert buffer tree.

ibuf_get_merge_page_nos(): Add parenthesis, to reduce diffs to
branches/innodb+.

ibuf_contract_ext(): Do not pick an insert buffer tree at random.
There is only one.

ibuf_print(): Print the single insert buffer tree.

rb://19 approved by Heikki on IM
2008-12-12 14:08:23 +00:00
marko
565b4b8e7c branches/zip: Improve code locality in btr_cur_search_to_nth_level().
Make the variables rw_latch and buf_mode local in the for loop.
Initialize them at the beginning of each for loop round to reduce
register spilling on register-starved platforms such as the x86.  Move
the assignment of rw_latch and buf_mode from the end of the loop to
the beginning of the loop.  These parameters will only be needed in
the buf_page_get_gen() call at the start of the loop.

Remove the second (redundant) call to ibuf_should_try().

ibuf_should_try(): Now that the successful calls to this function will
be halved, halve the magic constant that ibuf_flush_count will be
compared to, accordingly.

rb://61 approved by Heikki over IM.
2008-12-12 12:22:34 +00:00
calvin
cb876f88df branches/zip: fix Mantis issue #138 InnoDB fails if
innodb_buffer_pool_size >= 4096M on x64 Windows

All three srv_buf_pool related variables are defined as ulong, which is
32-bit on 64-bit Windows. They are changed to 64-bit ulint. Also
system_info.dwPageSize appears to be 32-bit only. Casting to 64-bit
is required.

Approved by:	Marko (on IM)
2008-12-10 22:19:07 +00:00
vasil
23a752360e branches/zip:
Revert our temporary fix for Bug#40360 Binlog related errors with binlog off

This bug was fixed in MySQL code.

Our fix went into r2944 and r2947, but this patch does not entirely revert
those revisions because we want to leave the test case that was introduced
and also r2944 itself reverted r2935 and r2936. So if we completely revert
r2944 and r2947 then we would loose the test and will restore r2935 and
r2936.

This resolves Issue#108 We should remove ib_bin_log_is_engaged() once mysql
add an equivallent, see Bug#40360
2008-12-04 16:49:24 +00:00
vasil
931fc75cb0 branches/zip:
Now that 1.0.2 is out, the current tree is version 1.0.3.
2008-12-02 10:11:54 +00:00