Commit graph

3755 commits

Author SHA1 Message Date
Marko Mäkelä
ddec6ecdd8 Bug#11877216 InnoDB too eager to commit suicide on a busy server
sync_array_print_long_waits(): Return the longest waiting thread ID
and the longest waited-for lock. Only if those remain unchanged
between calls in srv_error_monitor_thread(), increment
fatal_cnt. Otherwise, reset fatal_cnt.

Background: There is a built-in watchdog in InnoDB whose purpose is to
kill the server when some thread is stuck waiting for a mutex or
rw-lock. Before this fix, the logic was flawed.

The function sync_array_print_long_waits() returns TRUE if it finds a
lock wait that exceeds 10 minutes (srv_fatal_semaphore_wait_threshold).
The function srv_error_monitor_thread() will kill the server if this
happens 10 times in a row (fatal_cnt reaches 10), checked every 30
seconds. This is wrong, because this situation does not mean that the
server is hung. If the server is very busy for a little over 15
minutes, it will be killed.

Consider this example. Thread T1 is waiting for mutex M. Some time
later, threads T2..Tn start waiting for the same mutex M. If T1 keeps
waiting for 600 seconds, fatal_cnt will be incremented to 1. So far,
so good. Now, if M is granted to T1, the server was obviously not
stuck. But, T2..Tn keeps waiting, and their wait time will be longer
than 600 seconds. If 5 minutes later, some Tn has still been waiting
for more than 10 minutes for the mutex M, the server can be killed,
even though it is not stuck.

rb:622 approved by Jimmy Yang
2011-03-30 14:25:58 +03:00
Magne Mahre
9ff72a1acf Bug#11900714 REMOVE LGPL LICENSED FILES IN MYSQL 5.1
The LGPL license is used in some legacy code, and to
adhere to current licensing polity, we remove those
files that are no longer used, and reorganize the
remaining LGPL code so it will be GPL licensed from
now on.
      
Note:  This patch only removed LGPL licensed files
       in MySQL 5.1, and is the second of a set of
       patches to remove LGPL from all trees.
       (See Bug# 11840513 for details)
2011-03-28 10:47:30 +02:00
Vasil Dimov
08d598fb98 Store the '\0'-terminated query in row->trx_query
This problem was introduced in
marko.makela@oracle.com-20100514130815-ym7j7cfu88ro6km4
and is probably the reason for the following valgrind warning:

from http://bugs.mysql.com/52691 , http://bugs.mysql.com/file.php?id=16880 :

Version: '5.6.3-m5-valgrind-max-debug'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution
==14947== Thread 18:
==14947== Conditional jump or move depends on uninitialised value(s)
==14947==    at 0x4A06318: __GI_strlen (mc_replace_strmem.c:284)
==14947==    by 0x9F3D7A: fill_innodb_trx_from_cache(trx_i_s_cache_struct*, THD*, TABLE*) (i_s.cc:591)
==14947==    by 0x9F4D7D: trx_i_s_common_fill_table(THD*, TABLE_LIST*, Item*) (i_s.cc:1238)
==14947==    by 0x7689F3: get_schema_tables_result(JOIN*, enum_schema_table_state) (sql_show.cc:6745)
==14947==    by 0x715A75: JOIN::exec() (sql_select.cc:2861)
==14947==    by 0x7185BD: mysql_select(THD*, Item***, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:3609)
==14947==    by 0x70E823: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:319)
==14947==    by 0x6F2305: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:4557)
==14947==    by 0x6EAED4: mysql_execute_command(THD*) (sql_parse.cc:2135)
==14947==    by 0x6F44C9: mysql_parse(THD*, char*, unsigned int, Parser_state*) (sql_parse.cc:5597)
==14947==    by 0x6E864B: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1093)
==14947==    by 0x6E785E: do_command(THD*) (sql_parse.cc:815)
==14947==    by 0x6C18DD: do_handle_one_connection(THD*) (sql_connect.cc:771)
==14947==    by 0x6C146E: handle_one_connection (sql_connect.cc:707)
==14947==    by 0x30E1807760: start_thread (pthread_create.c:301)
==14947==    by 0x35EA670F: ???
==14947==  Uninitialised value was created by a heap allocation
==14947==    at 0x4A0515D: malloc (vg_replace_malloc.c:195)
==14947==    by 0xB4B948: mem_area_alloc (mem0pool.c:385)
==14947==    by 0xB4A27C: mem_heap_create_block (mem0mem.c:333)
==14947==    by 0xB4A530: mem_heap_add_block (mem0mem.c:446)
==14947==    by 0xB0D2A4: mem_heap_alloc (mem0mem.ic:186)
==14947==    by 0xB0D9C2: ha_storage_put_memlim (ha0storage.c:118)
==14947==    by 0xA479D8: fill_trx_row (trx0i_s.c:521)
==14947==    by 0xA490E9: fetch_data_into_cache (trx0i_s.c:1319)
==14947==    by 0xA491BA: trx_i_s_possibly_fetch_data_into_cache (trx0i_s.c:1352)
==14947==    by 0x9F4CE7: trx_i_s_common_fill_table(THD*, TABLE_LIST*, Item*) (i_s.cc:1221)
==14947==    by 0x7689F3: get_schema_tables_result(JOIN*, enum_schema_table_state) (sql_show.cc:6745)
==14947==    by 0x715A75: JOIN::exec() (sql_select.cc:2861)
==14947==    by 0x7185BD: mysql_select(THD*, Item***, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:3609)
==14947==    by 0x70E823: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:319)
==14947==    by 0x6F2305: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:4557)
==14947==    by 0x6EAED4: mysql_execute_command(THD*) (sql_parse.cc:2135)
==14947==    by 0x6F44C9: mysql_parse(THD*, char*, unsigned int, Parser_state*) (sql_parse.cc:5597)
==14947==    by 0x6E864B: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1093)
==14947==    by 0x6E785E: do_command(THD*) (sql_parse.cc:815)
==14947==    by 0x6C18DD: do_handle_one_connection(THD*) (sql_connect.cc:771)
==14947==    by 0x6C146E: handle_one_connection (sql_connect.cc:707)
==14947==    by 0x30E1807760: start_thread (pthread_create.c:301)
==14947==    by 0x35EA670F: ???


(gdb) bt
#0  0x0000000004a06318 in _vgrZU_libcZdsoZa___GI_strlen (str=0x3026bfa0 "insert into `blobtest` set `data`='pkefxxpkalpabzgrczlxefkreqljeqbvzrcnhvhsjsfnvxzjsltfuincffigdkmhvvcmnseluzgbtedrfmxvnrdmzesbinjgwvharkpgjplrlnqudfidbqwgbykupycxzyikzqincnsjrxgncqzlgyqwjdbjulztgsffxpjgymsnntdibvklwqylmwhsmdskmllxuwafabdjnwlyofknwuixiyrgnplmerfdewgizkdhznitesfqepsqbbwkdepkmjoseyxjofmmjaqdipwopfrwidmhqbtovdslvayxcnpewzhppeetblccppniamezibuoinvlxkafpcmozawtplfpepxwlwhymsuraezcwvjqzwogsozodlsfzjiyrcaljjhqwdrcjawvelhefzzaexvcbyorlcyupqwgjuamiqpiputtndjwcsuyzdfhuxswuowhrzdvriwrxqmcqthvzzzvivbabbnhdbtcfdtgssvmirrcddnytnctcvqplwytxxzxelldhwahalzxvgynaiwjyezhxqhlsqudngekocfvlbqprxqhyhwbaomgqiwkpfguohuvlnhtrsszgacxhhzeppyqwfwabiqzgyzkperiidyunrykopysvlcxwhrcboetjltawdjergalsfvaxncmzoznryumrjmncvhvxqvqhhbznnifkguuiffmlrbmgwtzvnuwlaguixqadkupfhasbbxnwkrvsfhrqanfmvjtzfqodtutkjlxfcogtsjywrdgmzgszjtsmimaelsveayqrwviqwwefeziuaqsqpauxpnzhaxjtkdfvvodniwezskbxfxszyniyzkzxngcfwgjlyrlskmrzxqnptwlilsxybuguafxxkvryyjrnkhhcmxuusitaflaiuxjhyfnzkahlgmaszujqmfdhyppdnpweqanmvzgjfyzjolbmprhnuuxextcaxzicfvsuochprmlf"...) at mc_replace_strmem.c:284
#1  0x00000000009f3d7b in fill_innodb_trx_from_cache (cache=0x1462440, thd=0x2a495000, table=0x2a422500) at /home/sbester/build/bzr/mysql-trunk/storage/innobase/handler/i_s.cc:591
#2  0x00000000009f4d7e in trx_i_s_common_fill_table (thd=0x2a495000, tables=0x2a4c3ec0) at /home/sbester/build/bzr/mysql-trunk/storage/innobase/handler/i_s.cc:1238
#3  0x00000000007689f4 in get_schema_tables_result (join=0x30f90c40, executed_place=PROCESSED_BY_JOIN_EXEC) at /home/sbester/build/bzr/mysql-trunk/sql/sql_show.cc:6745
#4  0x0000000000715a76 in JOIN::exec (this=0x30f90c40) at /home/sbester/build/bzr/mysql-trunk/sql/sql_select.cc:2861
#5  0x00000000007185be in mysql_select (thd=0x2a495000, rref_pointer_array=0x2a497590, tables=0x2a4c3ec0, wild_num=1, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2684619520, result=0x30319720, unit=0x2a496d28, select_lex=0x2a497378) at /home/sbester/build/bzr/mysql-trunk/sql/sql_select.cc:3609
#6  0x000000000070e824 in handle_select (thd=0x2a495000, lex=0x2a496c78, result=0x30319720, setup_tables_done_option=0) at /home/sbester/build/bzr/mysql-trunk/sql/sql_select.cc:319
#7  0x00000000006f2306 in execute_sqlcom_select (thd=0x2a495000, all_tables=0x2a4c3ec0) at /home/sbester/build/bzr/mysql-trunk/sql/sql_parse.cc:4557
#8  0x00000000006eaed5 in mysql_execute_command (thd=0x2a495000) at /home/sbester/build/bzr/mysql-trunk/sql/sql_parse.cc:2135
#9  0x00000000006f44ca in mysql_parse (thd=0x2a495000, rawbuf=0x30d80060 "select * from innodb_trx", length=24, parser_state=0x35ea5540) at /home/sbester/build/bzr/mysql-trunk/sql/sql_parse.cc:5597
#10 0x00000000006e864c in dispatch_command (command=COM_QUERY, thd=0x2a495000, packet=0x30bb4e31 "select * from innodb_trx", packet_length=24) at /home/sbester/build/bzr/mysql-trunk/sql/sql_parse.cc:1093
#11 0x00000000006e785f in do_command (thd=0x2a495000) at /home/sbester/build/bzr/mysql-trunk/sql/sql_parse.cc:815
#12 0x00000000006c18de in do_handle_one_connection (thd_arg=0x2a495000) at /home/sbester/build/bzr/mysql-trunk/sql/sql_connect.cc:771
#13 0x00000000006c146f in handle_one_connection (arg=0x2a495000) at /home/sbester/build/bzr/mysql-trunk/sql/sql_connect.cc:707
#14 0x00000030e1807761 in start_thread (arg=0x35ea6710) at pthread_create.c:301
#15 0x00000030e14e14ed in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115
(gdb) frame 1
#1  0x00000000009f3d7b in fill_innodb_trx_from_cache (cache=0x1462440, thd=0x2a495000, table=0x2a422500) at /home/sbester/build/bzr/mysql-trunk/storage/innobase/handler/i_s.cc:591
591                                     row->trx_query_cs);
(gdb) list
586                     if (row->trx_query) {
587                             /* store will do appropriate character set
588                             conversion check */
589                             fields[IDX_TRX_QUERY]->store(
590                                     row->trx_query, strlen(row->trx_query),
591                                     row->trx_query_cs);
592                             fields[IDX_TRX_QUERY]->set_notnull();
593                     } else {
594                             fields[IDX_TRX_QUERY]->set_null();
595                     }
2011-03-28 11:34:12 +03:00
Mattias Jonsson
e0887df8e1 Bug#11766249 bug#59316: PARTITIONING AND INDEX_MERGE MEMORY LEAK
When executing row-ordered-retrieval index merge,
the handler was cloned, but it used the wrong
memory root, so instead of allocating memory
on the thread/query's mem_root, it used the table's
mem_root, resulting in non released memory in the
table object, and was not freed until the table was
closed.

Solution was to ensure that memory used during cloning
of a handler was allocated from the correct memory root.

This was implemented by fixing handler::clone() to also
take a name argument, so it can be used with partitioning.
And in ha_partition only allocate the ha_partition's ref, and
call the original ha_partition partitions clone() and set at cloned
partitions.

Fix of .bzrignore on Windows with VS 2010
2011-03-25 12:36:02 +01:00
Marko Mäkelä
4f4b404e59 Bug#11849231 inflateInit() invoked without initializing all memory
According to the zlib documentation, next_in and avail_in
must be initialized before invoking inflateInit or inflateInit2.
Furthermore, the zalloc function must clear the allocated memory.

btr_copy_zblob_prefix(): Replace the d_stream parameter with buf,len
and return the copied length.

page_zip_decompress(): Invoke inflateInit2 a little later.

page_zip_zalloc(): Rename from page_zip_alloc().
Invoke mem_heap_zalloc() instead of mem_heap_alloc().

rb:619 approved by Jimmy Yang
2011-03-15 12:01:02 +02:00
Georgi Kodinov
2f682d3f72 merge 5.1->5.1-security 2011-03-09 16:50:06 +02:00
Sergey Vojtovich
54755c78cf BUG#11764339 - valgrind errors, random data when returning
ordered data from archive tables

Archive was using wrong memory address to check if field
is NULL (after filesort, when reading record again).

mysql-test/r/archive.result:
  A test case for BUG#11764339.
mysql-test/t/archive.test:
  A test case for BUG#11764339.
storage/archive/ha_archive.cc:
  Null bytes are restored to "record" buffer, which may
  or may not be equal to record buffer for field. Check
  null bits in "record" buffer, instead of Field::null_ptr.
2011-03-03 11:43:07 +03:00
Vasil Dimov
71be1473b9 Merge mysql-5.1 -> mysql-5.1-innodb 2011-03-02 10:59:43 +02:00
Marko Mäkelä
0f8ae318c7 Bug #58549 Race condition in buf_LRU_drop_page_hash_for_tablespace()
and compressed tables

buf_LRU_drop_page_hash_for_tablespace(): after releasing and
reacquiring the buffer pool mutex, do not dereference any block
descriptor pointer that is not known to be a pointer to an
uncompressed page frame (type buf_block_t; state ==
BUF_BLOCK_FILE_PAGE). Also, defer the acquisition of the block_mutex
until it is needed.

buf_page_get_gen(): Add mode == BUF_GET_IF_IN_POOL_PEEK for
buffer-fixing a block without making it young in the LRU list.

buf_page_get_gen(), buf_page_init(), buf_LRU_block_remove_hashed_page():
Set bpage->state = BUF_BLOCK_ZIP_FREE before buf_buddy_free(bpage),
so that similar race conditions might be detected a little easier.

btr_search_drop_page_hash_when_freed(): Use BUF_GET_IF_IN_POOL_PEEK
when dropping the hash indexes.

rb://528 approved by Jimmy Yang
2011-02-28 13:51:18 +02:00
Vasil Dimov
5a805fe7c4 Fix BUG#11798085 - INCORRECT INTEGER TYPES USED IN CALCULATION RESULT
IN OVERFLOW

Do not assign the result of the difference to a signed variable and
checking whether it is negative afterwards because this limits the max diff
to 2G on 32 bit systems. E.g. "signed = 3.5G - 1G" would be negative and the
code would assume that 3.5G < 1G. Instead compare the two variables directly
and assign to unsigned only if we know that the result of the subtraction
will be positive.

Discussed with:	Jimmy and Sunny (via IRC)
2011-02-25 11:50:18 +02:00
Vasil Dimov
0bbaf6e8a7 Merge mysql-5.1-innodb -> mysql-5.1 2011-02-17 13:56:05 +02:00
Dmitry Lenev
9c89cca5e3 Fix for bug#11766714 (former bug @59888) "debug assertion when
attempt to create spatial index on char > 31 bytes".

Attempt to create spatial index on char field with length
greater than 31 byte led to assertion failure on server
compiled with safemutex support.

The problem occurred in mi_create() function which was called
to create a new version of table being altered. This function
failed since it detected an attempt to create a spatial key
on non-binary column and tried to return an error.
On its error path it tried to unlock THR_LOCK_myisam mutex
which has not been not locked at this point. Indeed such an
incorrect behavior was caught by safemutex wrapper and caused
assertion failure.

This patch fixes the problem by ensuring that mi_create()
doesn't releases THR_LOCK_myisam mutex on error path if it was
not acquired.

mysql-test/r/gis.result:
  Added test for bug @59888 "debug assertion when attempt to
  create spatial index on char > 31 bytes".
mysql-test/t/gis.test:
  Added test for bug @59888 "debug assertion when attempt to
  create spatial index on char > 31 bytes".
storage/myisam/mi_create.c:
  Changed mi_create() not to release THR_LOCK_myisam mutex on
  error path if it was not acquired.
2011-02-15 14:03:05 +03:00
Marko Mäkelä
0efaef7d46 Bug#59307 Valgrind: uninitialized value in rw_lock_set_writer_id_and_recursion_flag()
rw_lock_create_func(): Initialize lock->writer_thread, so that Valgrind
will not complain even when Valgrind instrumentation is not enabled.
Flag lock->writer_thread uninitialized, so that Valgrind can complain
when it is used uninitialized.

rw_lock_set_writer_id_and_recursion_flag(): Revert the bogus Valgrind
instrumentation that was pushed in the first attempt to fix this bug.
2011-02-15 10:51:33 +02:00
Jimmy Yang
4a8c835746 Fix Bug #59749 Enabling concurrent reads while creating non-primary unique
index gives failures.

Approved by Marko
2011-02-14 02:07:59 -08:00
Vasil Dimov
b5c61ed1f2 Fix Bug#59307 Valgrind: uninitialized value in rw_lock_set_writer_id_and_recursion_flag()
by silencing a bogus Valgrind warning:

==4392== Conditional jump or move depends on uninitialised value(s)
==4392==    at 0x5A18416: rw_lock_set_writer_id_and_recursion_flag (sync0rw.ic:283)
==4392==    by 0x5A1865C: rw_lock_x_lock_low (sync0rw.c:558)
==4392==    by 0x5A18481: rw_lock_x_lock_func (sync0rw.c:617)
==4392==    by 0x597EEE6: mtr_x_lock_func (mtr0mtr.ic:271)
==4392==    by 0x597EBBD: fsp_header_init (fsp0fsp.c:970)
==4392==    by 0x5A15E78: innobase_start_or_create_for_mysql (srv0start.c:1508)
==4392==    by 0x598B789: innobase_init(void*) (ha_innodb.cc:2282)

os_compare_and_swap_thread_id() is defined as
__sync_bool_compare_and_swap(). From the GCC doc:

`bool __sync_bool_compare_and_swap (TYPE *ptr, TYPE oldval TYPE newval, ...)'
  ...
  The "bool" version returns true if the comparison is successful and
  NEWVAL was written.

So it is not possible that the return value is uninitialized, no matter what
the arguments to os_compare_and_swap_thread_id() are. Probably Valgrind gets
confused by the implementation of the GCC internal function
__sync_bool_compare_and_swap().
2011-02-10 17:16:32 +02:00
Vasil Dimov
8aa7e213dc Increment InnoDB Plugin version from 1.0.15 to 1.0.16.
InnoDB Plugin 1.0.15 has been released with MySQL 5.1.55.
2011-02-10 13:21:22 +02:00
Vasil Dimov
aa7a928502 Merge mysql-5.1-innodb -> mysql-5.1 2011-02-08 19:26:42 +02:00
unknown
17fe23e46c Merge from mysql-5.1.55-release 2011-02-08 12:52:33 +01:00
Marko Mäkelä
89621ad738 Implement UNIV_BLOB_DEBUG. An early version of this caught Bug #55284.
This option is known to be broken when tablespaces contain off-page
columns after crash recovery. It has only been tested when creating
the data files from the scratch.

btr_blob_dbg_t: A map from page_no:heap_no:field_no to first_blob_page_no.
This map is instantiated for every clustered index in index->blobs.
It is protected by index->blobs_mutex.

btr_blob_dbg_msg_issue(): Issue a diagnostic message.
Invoked when btr_blob_dbg_msg is set.

btr_blob_dbg_rbt_insert(): Insert a btr_blob_dbg_t into index->blobs.

btr_blob_dbg_rbt_delete(): Remove a btr_blob_dbg_t from index->blobs.

btr_blob_dbg_cmp(): Comparator for btr_blob_dbg_t.

btr_blob_dbg_add_blob(): Add a BLOB reference to the map.

btr_blob_dbg_add_rec(): Add all BLOB references from a record to the map.

btr_blob_dbg_print(): Display the map of BLOB references in an index.

btr_blob_dbg_remove_rec(): Remove all BLOB references of a record from
the map.

btr_blob_dbg_is_empty(): Check that no BLOB references exist to or
from a page. Disowned references from delete-marked records are
tolerated.

btr_blob_dbg_op(): Perform an operation on all BLOB references on a
B-tree page.

btr_blob_dbg_add(): Add all BLOB references from a B-tree page to the
map.

btr_blob_dbg_remove(): Remove all BLOB references from a B-tree page
from the map.

btr_blob_dbg_restore(): Restore the BLOB references after a failed
page reorganize.

btr_blob_dbg_set_deleted_flag(): Modify the 'deleted' flag in the BLOB
references of a record.

btr_blob_dbg_owner(): Own or disown a BLOB reference.

btr_page_create(), btr_page_free_low(): Assert that no BLOB references exist.

btr_create(): Create index->blobs for clustered indexes.

btr_page_reorganize_low(): Invoke btr_blob_dbg_remove() before copying
the records. Invoke btr_blob_dbg_restore() if the operation fails.

btr_page_empty(), btr_lift_page_up(), btr_compress(), btr_discard_page():
Invoke btr_blob_dbg_remove().

btr_cur_del_mark_set_clust_rec(): Invoke btr_blob_dbg_set_deleted_flag().

Other cases of modifying the delete mark are either in the secondary
index or during crash recovery, which we do not promise to support.

btr_cur_set_ownership_of_extern_field(): Invoke btr_blob_dbg_owner().

btr_store_big_rec_extern_fields(): Invoke btr_blob_dbg_add_blob().

btr_free_externally_stored_field(): Invoke btr_blob_dbg_assert_empty()
on the first BLOB page.

page_cur_insert_rec_low(), page_cur_insert_rec_zip(),
page_copy_rec_list_end_to_created_page(): Invoke btr_blob_dbg_add_rec().

page_cur_insert_rec_zip_reorg(), page_copy_rec_list_end(),
page_copy_rec_list_start(): After failure, invoke
btr_blob_dbg_remove() and btr_blob_dbg_add().

page_cur_delete_rec(): Invoke btr_blob_dbg_remove_rec().

page_delete_rec_list_end(): Invoke btr_blob_dbg_op(btr_blob_dbg_remove_rec).

page_zip_reorganize(): Invoke btr_blob_dbg_remove() before copying the records.

page_zip_copy_recs(): Invoke btr_blob_dbg_add().

row_upd_rec_in_place(): Invoke btr_blob_dbg_rbt_delete() and
btr_blob_dbg_rbt_insert().

innobase_start_or_create_for_mysql(): Warn when UNIV_BLOB_DEBUG is enabled.

rb://550 approved by Jimmy Yang
2011-02-08 12:56:23 +02:00
Marko Mäkelä
5adf2313f7 Bug #55284 diagnostics: Introduce UNIV_BLOB_LIGHT_DEBUG, enabled by UNIV_DEBUG
btr_rec_get_field_ref_offs(), btr_rec_get_field_ref(): New functions.
Get the pointer to an externally stored field.

btr_cur_set_ownership_of_extern_field(): Assert that the BLOB has not
already been disowned.

btr_store_big_rec_extern_fields(): Rename to
btr_store_big_rec_extern_fields_func() and add the debug parameter
update_in_place. All pointers to externally stored columns in the
record must either be zero or they must be pointers to inherited
columns, owned by this record or an earlier record version. For any
BLOB that is stored, the BLOB pointer must previously have been
zero. When the function completes, all BLOB pointers must be nonzero
and owned by the record.

rb://549 approved by Jimmy Yang
2011-02-02 15:51:08 +02:00
Marko Mäkelä
7c45708f5d Non-functional changes (cleanup) made while narrowing down Bug #55284:
row_purge(): Change the return type to void. (The return value always
was DB_SUCCESS.) Remove some local variables.

row_undo_mod_remove_clust_low(): Remove some local variables.

rb://547 approved by Jimmy Yang
2011-02-02 14:12:49 +02:00
Marko Mäkelä
f2eacde4cd Bug #55284 diagnostics: When UNIV_DEBUG, do not tolerate garbage in
Antelope files in btr_check_blob_fil_page_type(). Unfortunately, we
must keep the check in production builds, because InnoDB wrote
uninitialized garbage to FIL_PAGE_TYPE until fairly recently (5.1.x).

rb://546 approved by Jimmy Yang
2011-02-02 14:10:12 +02:00
Marko Mäkelä
1f796c2b64 Bug #55284 diagnostics: Enable UNIV_DEBUG_FILE_ACCESSES by UNIV_DEBUG
It was the enabling of UNIV_DEBUG_FILE_ACCESSES that caught Bug #55284
in the first place. This is a very light piece of of debug code, and
there really is no reason why it is not enabled in all debug builds.

rb://551 approved by Jimmy Yang
2011-02-02 14:05:12 +02:00
Marko Mäkelä
e952ee1158 Bug#59230 assert 0 row_upd_changes_ord_field_binary() in post-crash
trx rollback or purge

This patch does not relax the failing debug assertion during purge.
That will be revisited once we have managed to repeat the assertion failure.

row_upd_changes_ord_field_binary_func(): Renamed from
row_upd_changes_ord_field_binary(). Add the parameter que_thr_t* in
UNIV_DEBUG builds. When the off-page column cannot be retrieved,
assert that the current transaction is a recovered one and that it is
the one that is currently being rolled back.

row_upd_changes_ord_field_binary(): A wrapper macro for
row_upd_changes_ord_field_binary_func() that discards the que_thr_t*
parameter unless UNIV_DEBUG is defined.

row_purge_upd_exist_or_extern_func(): Renamed from
row_purge_upd_exist_or_extern(). Add the parameter que_thr_t* in
UNIV_DEBUG builds.

row_purge_upd_exist_or_extern(): A wrapper macro for
row_purge_upd_exist_or_extern_func() that discards the que_thr_t*
parameter unless UNIV_DEBUG is defined.

Make trx_roll_crash_recv_trx const. If there were a 'do not
dereference' attribute, it would be appropriate as well.

rb://588 approved by Jimmy Yang
2011-01-31 09:56:51 +02:00
Vasil Dimov
6f8c6da4b5 Merge mysql-5.1-innodb -> mysql-5.1 2011-01-30 18:41:58 +02:00
Jimmy Yang
71e8043bae Fix Bug #59465 btr_estimate_number_of_different_key_vals use incorrect offset
for external_size
      
rb://581 approved by Marko
2011-01-28 00:50:10 -08:00
Marko Mäkelä
786ac62c82 Bug#59440 Race condition in XA ROLLBACK and XA COMMIT after server restart
trx_get_trx_by_xid(): Invalidate trx->xid after a successful lookup,
so that subsequent callers will not find the same transaction.

The only callers of trx_get_trx_by_xid() will be invoking
innobase_commit_low() or innobase_rollback_trx(), and those code paths
should not depend on trx->xid.

rb://584 approved by Jimmy Yang
2011-01-27 13:27:29 +02:00
Marko Mäkelä
e44703db76 Bug#59585 Fix 58912 introduces compiler warning
due to potentially uninitialized variable

row_upd_changes_ord_field_binary(): Initialize dfield_len to suppress the
warning. The compiler cannot know that row_ext_lookup() does initialize
dfield_len for us, as it is defined in a different module.
2011-01-25 15:43:08 +02:00
Marko Mäkelä
896e0ba4e0 Bug#59486 Incorrect usage of UNIV_UNLIKELY() in mlog_parse_string()
mlog_parse_string(): Enclose the comparison in UNIV_UNLIKELY,
not the comparand.
2011-01-25 12:17:28 +02:00
Marko Mäkelä
46b7ef6991 Bug#59464 Race condition in row_vers_build_for_semi_consistent_read
row_vers_build_for_semi_consistent_read(): Dereference version_trx before
releasing kernel_mutex, but not thereafter.
2011-01-25 11:54:50 +02:00
Marko Mäkelä
60a622d1c1 Bug#59707 Unused compression-related parameters in buffer pool functions
buf_block_alloc(): ulint zip_size is always 0.
buf_LRU_get_free_block(): ulint zip_size is always 0.
buf_LRU_free_block(): ibool* buf_pool_mutex_released is always NULL.

Remove these parameters.

buf_LRU_get_free_block(): Simplify the initialization of block->page.zip
and release buf_pool_mutex() earlier.
2011-01-25 09:56:18 +02:00
Marko Mäkelä
359bddbee1 Bug#59579 rw_lock_debug_print outputs to stderr
rw_lock_debug_print(): Add parameter FILE* for specifying the output stream.
rw_lock_list_print_info(): Invoke rw_lock_debug_print() on file, not stderr.
2011-01-18 12:25:13 +02:00
Marko Mäkelä
1f3975b4f8 Non-functional changes.
Remove the unused data type dict_cluster_t.
Remove a bogus comment about latching order.
2011-01-17 14:06:48 +02:00
Jimmy Yang
9cd4d49840 Fix Bug#30423 "InnoDBs treatment of NULL in index stats causes bad
"rows examined" estimates". This change implements "innodb_stats_method"
with options of "nulls_equal", "nulls_unequal" and "null_ignored".
      
rb://553 approved by Marko
2011-01-14 09:02:28 -08:00
Marko Mäkelä
7fb17e42cf Bug#59181 InnoDB compilation failure on the Sun Studio compiler
Define UNIV_PREFETCH_R(add) as sun_prefetch_read_many((void*) addr),
because apparently some versions of the Sun library
omit the const qualifier.
2011-01-10 15:34:45 +02:00
Georgi Kodinov
83b4e920e2 merge 2011-01-10 15:08:33 +02:00
Vasil Dimov
2815ffeeb9 Increment InnoDB Plugin version from 1.0.14 to 1.0.15.
InnoDB Plugin 1.0.14 has been released with MySQL 5.1.54.
2011-01-08 16:51:19 +02:00
Vasil Dimov
8a49f0b138 Followup to vasil.dimov@oracle.com-20110107091222-q23qpb5skev0j9gc
Do not use nested AC_CHECK_FUNC() because they result in:

./configure: line 52688: syntax error: unexpected end of file

(which happens only on some platforms and does not happen on others,
I have no idea what is the reason for this)
2011-01-07 16:52:44 +02:00
Georgi Kodinov
1ec2fccd6d automerge 2011-01-07 15:30:42 +02:00
Vasil Dimov
3d27658dae Merge mysql-5.1 -> mysql-5.1-innodb 2011-01-07 13:46:21 +02:00
Vasil Dimov
7365ef123c Fix Bug#59327 Fix autoconf usage for innodb_plugin
AC_CHECK_FUNCS(f1 f2 f3, ACTION_IF_PRESENT)
ACTION_IF_PRESENT is executed if any of f1, f2 or f3 is present.
Fix this misusage, we want the action to be executed if all of the
functions are present.
2011-01-07 11:12:22 +02:00
Jimmy Yang
95cc85dbf5 Backport Bug #58643 InnoDB: too long table name. Also fix Bug #59312 examine
MAX_FULL_NAME_LEN in InnoDB to address possible insufficient name buffer

Bug #59312 Approved by Sunny Bains
2011-01-06 23:45:59 -08:00
Jimmy Yang
5ef429fd3c Fix Bug #55397 cannot select from innodb_trx when trx_query contains blobs
that aren't strings

rb://560 approved by Sunny Bains
2011-01-06 19:36:20 -08:00
Vasil Dimov
fd7de284d4 (InnoDB Plugin) Fix Bug#59303 Correct URL in crash message
old URL: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html
new URL: http://dev.mysql.com/doc/refman/5.1/en/forcing-innodb-recovery.html

Notice that there is a redirect from the old URL to the new URL, so visiting
the old URL does not give "page not found" error.
2011-01-06 09:12:53 +02:00
Vasil Dimov
15273e4310 (Builtin InnoDB) Fix Bug#59303 Correct URL in crash message
old URL: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html
new URL: http://dev.mysql.com/doc/refman/5.1/en/forcing-innodb-recovery.html

Notice that there is a redirect from the old URL to the new URL, so visiting
the old URL does not give "page not found" error.
2011-01-06 09:05:45 +02:00
Jimmy Yang
fe8fbaaddb Fix Bug #59197 double quote in field comment prevents foreign key
constraint creation

rb://557 Approved by Sunny Bains
2011-01-04 22:44:12 -08:00
Jimmy Yang
c143ff4848 Fix Bug #59157 valgrind conditional jump warning from dict_load_foreign.
This is 5.1 built-in specific as the dict_table_t strcture is allocated
with mem_heap_zalloc since 5.1 plugin.

Approved by Sunny Bains
2011-01-04 22:31:46 -08:00
Kent Boortz
4acfdb9df1 Merge 2010-12-29 00:47:05 +01:00
Calvin Sun
845e725a51 Fix a build error on Windows, introduced by revision-id:
marko.makela@oracle.com-20101221112722-1yxxzzgqtem8bcm7

The fix was suggested by Jimmy.
2010-12-27 22:55:49 -06:00
Marko Mäkelä
721a890e48 Bug #55284 Double BLOB free due to lock wait while updating PRIMARY KEY
This bug fix requires that Bug #58912 be fixed as well (bzr revision id
marko.makela@oracle.com-20101221093919-mcmmgd4zpse9567d). Otherwise,
another double BLOB free could occur when InnoDB would try to perform
an update-in-place as delete-and-insert-by-update-in-place.

row_upd_clust_rec_by_insert(): Do not disown the externally stored
columns from the old record (btr_cur_mark_extern_inherited_fields())
until after checking the foreign key constraints and successfully
inserting the updated record. If a lock wait timeout occurs between
the delete-marking of the old record and the insertion of the updated
record, mark the columns inherited before retrying the insert.
Distinguish the state UPD_NODE_INSERT_BLOB from
UPD_NODE_INSERT_CLUSTERED.

btr_cur_del_mark_set_clust_rec(): Replace the cursor with
block,rec,index,offsets so that the offsets need not be recalculated.
Assert that rec is on a clustered index leaf page.

btr_cur_disown_inherited_fields(): Renamed from
btr_cur_mark_extern_inherited_fields(). Use
upd_get_field_by_field_no(). Assert that there are externally stored
columns. Assert that a mini-transaction is passed. Remove the return
status. (The only caller, row_upd_clust_rec_by_insert(), will have
determined that some fields have changed ownership.)

btr_cur_mark_dtuple_inherited_extern(): Rename to
row_upd_clust_rec_by_insert_inherit_func() and declare as static. Add
the debug parameters rec, offsets. When rec is given, assert that the
off-page columns match those in the inesrt tuple and that the off-page
columns are owned by the record. Assert that the non-updated off-page
columns in the insert tuple are owned, and mark them inherited.

row_upd_clust_rec_by_insert_inherit(): A wrapper macro for
row_upd_clust_rec_by_insert_inherit_func().

row_undo_mod_upd_exist_sec(): Adjust a comment about
row_upd_clust_rec_by_insert().

rb:508 approved by Jimmy Yang
2010-12-21 13:27:22 +02:00
Marko Mäkelä
590fdf7792 Bug#58912 InnoDB unnecessarily avoids update-in-place on column prefix indexes
row_upd_changes_ord_field_binary(): Do not return TRUE if the update
vector changes a column that is covered by a prefix index, but does
not change the column prefix. Add the row_ext_t parameter for
determining whether the prefixes of externally stored columns match.

dfield_datas_are_binary_equal(): Add the parameter len, for comparing
column prefixes when len > 0.

innodb.test: Add a test case where the patch of Bug #55284 failed
without this fix.

rb:537 approved by Jimmy Yang
2010-12-21 11:39:19 +02:00
Georgi Kodinov
2969956def merge 2010-12-17 15:05:50 +02:00
Vasil Dimov
8accdc996e Merge mysql-5.1-bugteam -> mysql-5.1-innodb 2010-12-12 11:21:17 +02:00
Jimmy Yang
662fb84a42 Fix Bug #57600 output of I/O sum[%lu] can go negative
rb://532 approved by Sunny Bains
2010-12-09 01:19:46 -08:00
Dmitry Shulga
5ca6880def Fixed bug#54486 - assert in my_seek, concurrent
DROP/CREATE SCHEMA, CREATE TABLE, REPAIR.

The cause of assert was concurrent execution of
DROP DATABASE and REPAIR TABLE where first statement
deleted table's file .TMD at the same time as
REPAIR TABLE tried to read file details from the old file
that was just removed.

Additionally was fixed trouble when DROP TABLE try delete
all files belong to table being dropped at the same time
when REPAIR TABLE statement has just deleted .TMD file.

No regression test added because this would require adding a
sync point to mysys/my_redel.c. Since this bug is not present in
5.5+, adding test coverage was considered unnecessary.
The patch has been verified using RQG testing.


sql/sql_db.cc:
  mysql_rm_known_files() modified: ignore possible ENOENT error
  when trying delete all table's files. Such aggressive 
  algorithm permits skip already deleted (in another thread)
  files.
  
  Installation of Drop_table_error_handler as internal error handler
  moved from mysql_rm_db() to mysql_rm_knowns_files() near to place
  where source of possible errors (call to mysql_rm_table_part2) located.
storage/myisam/mi_check.c:
  mi_repair() was modified: set param->retry_repair= 0
  in order to don't call following failover procedure
  in ha_myisam::repair().
2010-12-10 13:48:50 +06:00
Ramil Kalimullin
0137e02899 Fix for bug#48451: my_seek and my_tell ignore MY_WME flag
my_seek() and my_tell() functions now honour MY_WME flag.


include/mysys_err.h:
  Fix for bug#48451: my_seek and my_tell ignore MY_WME flag
    - EE_CANT_SEEK added, used in my_seek() and my_tell() functions.
mysys/errors.c:
  Fix for bug#48451: my_seek and my_tell ignore MY_WME flag
    - EE_CANT_SEEK added, used in my_seek() and my_tell() functions.
mysys/my_seek.c:
  Fix for bug#48451: my_seek and my_tell ignore MY_WME flag
    - my_seek() and my_tell() handle MY_WME flag.
mysys/my_symlink.c:
  Fix for bug#48451: my_seek and my_tell ignore MY_WME flag
    - __attribute__((unused)) removed, as myf MyFlags is
  actually used in the my_realpath() function.
storage/myisam/ha_myisam.cc:
  Fix for bug#48451: my_seek and my_tell ignore MY_WME flag
    - check my_seek() result.
2010-12-09 12:59:12 +03:00
Marko Mäkelä
469a811299 Bug#58623: Bogus debug assertion failure in i_s_locks_row_validate()
This bogus assertion was introduced in the fix of Bug #57802:
Empty ASSERTION parameter passed to the HASH_SEARCH macro.
2010-12-01 10:03:53 +02:00
unknown
f6c03ab820 RB://518 approved by Jimmy Yang and Sunny bains
Code cleanup after changes for Bug 56628.  The general approach for 
InnoDB is to make a reference to each enum value whenever it is used in a
switch statement.  In addition, no default case should be used for switch 
statements on enum types.  This assures that if there is ever any change 
in the enum values, the switch will need to change to reflect it since a 
compiler warning will occur.  In this case, the enum row_type is declared 
in handler.h and could be changed for another storage engine.  If so, a 
warning will occur in the InnoDB build.  

Other changes;
* This patch uses 2 macros to help consolidate warning messages that
   need to occur twice in the single switch for row_format.
* Using row_format as the variable name to distinguish it from the enum
  type.
* Function declaration format correction.
2010-11-30 10:03:55 -06:00
Sunny Bains
a699e4fce8 Fix Bug# 56228 - Dropping tables from within an active statement crashes server
InnoDB AUTOINC code expects the locks to be released in strict reverse order
at the end of the statement. However, nested stored proedures and partition
tables break this rule. We now allow the locks to be deleted from the
trx->autoinc_locks vector in any order but optimise for the common (old) case.

rb://441 Approved by Marko Makela
2010-11-30 20:11:26 +11:00
Vasil Dimov
e7e74cb620 Merge mysql-5.1-bugteam -> mysql-5.1-innodb 2010-11-29 09:07:11 +02:00
Georgi Kodinov
db8bd7beb8 merge 2010-11-26 14:51:48 +02:00
Vasil Dimov
e13bde85b5 Bug#47350 Support innodb plugin without separate shared object
Add a _commented_ workaround for Bug#47350. The full solution is tricky
to get right as explained in the bug report. It is not worth the effort
to extend the deprecated autotools framework to support conflicting
plugins and would be too risky for MySQL 5.1 (GA).
2010-11-25 08:55:47 +02:00
Sunny Bains
61c2b12da7 Fix bug# 18274 InnoDB auto_increment field reset on OPTIMIZE TABLE
OPTIMIZE TABLE recreates the whole table. That is why the counter gets reset.
Making the next autoinc column persistent is a separate issue from resetting
the value after an OPTIMIZE TABLE. We already have a check for ALTER TABLE
and CREATE INDEX to preserve the value on table recreate. We should be able to
add an additional check for OPTIMIZE TABLE to preserve the next value.

rb://519 Approved by Jimmy Yang.
2010-11-24 14:07:43 +11:00
Ramil Kalimullin
65116d3408 Manual-merge from mysql-5.1-bugteam. 2010-11-22 12:21:10 +03:00
Vasil Dimov
dacd97b487 Merge mysql-5.1-innodb -> mysql-5.1-bugteam 2010-11-18 15:45:36 +02:00
Ramil Kalimullin
e4d2fd35a7 Auto-merge from mysql-5.1-bugteam. 2010-11-18 13:40:57 +03:00
Marko Mäkelä
4bb4eb800e Fix a debug assertion failure in the Bug#57802 fix.
thr_local_create(): Initialize local->slot_no to ULINT_UNDEFINED.
thr_local_validate(): Allow local->slot_no to be ULINT_UNDEFINED.
2010-11-11 15:12:39 +02:00
Vasil Dimov
f9c2f7cd01 Remove unused parameter has_dict_mutex of dict_update_statistics_low()
Also delete dict_update_statistics() and rename dict_update_statistics_low()
to dict_update_statistics() because the only thing that distinguished those
two functions was the removed parameter.
2010-11-11 13:11:52 +02:00
Marko Mäkelä
db054043ac Bug#57802 Empty ASSERTION parameter passed to the HASH_SEARCH macro
thr_local_validate(), i_s_locks_row_validate(): New validate
functions, used in UNIV_DEBUG code for checking the state of internal
memory structures.
2010-11-11 11:55:35 +02:00
Marko Mäkelä
298717f419 Declarations and code do not mix in C90, not even within UNIV_DEBUG. 2010-11-11 11:39:09 +02:00
Jimmy Yang
f2215a11ac Fix Bug #48026 Log start and end of InnoDB buffer pool initialization
to the error log

rb://513 approved by Sunny Bains
2010-11-10 21:32:12 -08:00
Jimmy Yang
7ade161589 Port fix for Bug #48026 to 5.1 built-in and plugin: Log start and end
of InnoDB buffer pool initialization to the error log
2010-11-10 21:27:10 -08:00
Davi Arnaut
cd1c6e220d Bug#58057: 5.1 libmysql/libmysql.c unused variable/compile failure
Bug#57995: Compiler flag change build error on OSX 10.4: my_getncpus.c
Bug#57996: Compiler flag change build error on OSX 10.5 : bind.c
Bug#57994: Compiler flag change build error : my_redel.c
Bug#57993: Compiler flag change build error on FreeBsd 7.0 : regexec.c
Bug#57992: Compiler flag change build error on FreeBsd : mf_keycache.c
Bug#57997: Compiler flag change build error on OSX 10.6: debug_sync.cc

Fix assorted compiler generated warnings.

cmd-line-utils/readline/bind.c:
  Bug#57996: Compiler flag change build error on OSX 10.5 : bind.c
  
  Initialize variable to work around a false positive warning.
include/m_string.h:
  Bug#57994: Compiler flag change build error : my_redel.c
  
  The expansion of stpcpy (in glibc) causes warnings if the
  return value of strmov is not being used. Since stpcpy is
  a GNU extension and the expansion ends up using a built-in
  provided by GCC, use the compiler provided built-in directly
  when possible.
include/my_compiler.h:
  Define a dummy MY_GNUC_PREREQ when not compiling with GCC.
libmysql/libmysql.c:
  Bug#58057: 5.1 libmysql/libmysql.c unused variable/compile failure
  
  Variable might not be used in some cases. So, tag it as unused.
mysys/mf_keycache.c:
  Bug#57992: Compiler flag change build error on FreeBsd : mf_keycache.c
  
  Use UNINIT_VAR to work around a false positive warning.
mysys/my_getncpus.c:
  Bug#57995: Compiler flag change build error on OSX 10.4: my_getncpus.c
  
  Declare variable in the same block where it is used.
regex/regexec.c:
  Bug#57993: Compiler flag change build error on FreeBsd 7.0 : regexec.c
  
  Work around a compiler bug which causes the cast to not be enforced.
sql/debug_sync.cc:
  Bug#57997: Compiler flag change build error on OSX 10.6: debug_sync.cc
  
  Use UNINIT_VAR to work around a false positive warning.
sql/handler.cc:
  Use UNINIT_VAR to work around a false positive warning.
sql/slave.cc:
  Use UNINIT_VAR to work around a false positive warning.
sql/sql_partition.cc:
  Use UNINIT_VAR to work around a false positive warning.
storage/myisam/ft_nlq_search.c:
  Use UNINIT_VAR to work around a false positive warning.
storage/myisam/mi_create.c:
  Use UNINIT_VAR to work around a false positive warning.
storage/myisammrg/myrg_open.c:
  Use UNINIT_VAR to work around a false positive warning.
tests/mysql_client_test.c:
  Change function to take a pointer to const, no need for a cast.
2010-11-10 19:14:47 -02:00
Sergey Vojtovich
13bc5b3f3d BUG#58079 - Remove the IBM DB2 storage engine 2010-11-11 13:03:17 +03:00
Vasil Dimov
ce782ee2c2 Merge mysql-5.1-innodb from bk-internal into my local repo 2010-11-10 10:40:22 +02:00
Vasil Dimov
cf3433d7f3 Merge mysql-5.1-bugteam -> mysql-5.1-innodb 2010-11-08 16:46:26 +02:00
Marko Mäkelä
57cb45514d row_ins_index_entry(): Note that only CREATE INDEX sets foreign=FALSE. 2010-11-04 15:12:15 +02:00
Sunny Bains
1f0f542a42 Add change log entry for bug#54538 fix. 2010-11-04 09:41:36 +11:00
Georgi Kodinov
7b2e07232a merge 2010-11-03 16:09:17 +02:00
Marko Mäkelä
dfe39f68a9 rw_lock_debug_print(): Output the thread ID in unsigned format. 2010-11-03 14:38:36 +02:00
Vasil Dimov
a491492f15 Add ChangeLog entry for Bug#53046 2010-11-03 11:30:08 +02:00
Marko Mäkelä
bfc7040355 Bug#57947 InnoDB diagnostics shows btr_block_get calls instead of real callers
Improve the diagnostics of buffer pool accesses for B-trees,
so that the file names and line numbers of the real calls are shown
instead of the line of the buf_page_get() call in btr_block_get().

btr_page_get(): Replaced with a macro.

btr_block_get_func(): Renamed from btr_block_get(). Add file, line.

btr_block_get(): A macro that passes the __FILE__, __LINE__ to
btr_block_get_func().

dict_truncate_index_tree(): Replace a btr_page_get() call
with btr_block_get(), since we are only latching the page, not accessing it.
2010-11-03 11:19:12 +02:00
Marko Mäkelä
eab53d4e80 Non-functional change: Remove bogus const qualifiers
and make some function comments more accurate.
2010-11-03 11:16:11 +02:00
Sunny Bains
c64f952699 Fix Bug #54538 - use of exclusive innodb dictionary lock limits performance.
This patch doesn't get rid of the need to acquire the dict_sys->mutex but
reduces the need to keep the mutex locked for the duration of the query
to fsp_get_available_space_in_free_extents() from ha_innobase::info().
 
This is a port of revno:3548 from the builtin to the plugin.

rb://501 Approved by Jimmy Yang and Marko Makela.
2010-11-03 12:40:53 +11:00
unknown
64e476e070 In this patch, existing tests innodb_bug54679.test and innodb_bug56632.test are
removed and replaced by the comprehensive innodb-create-options.test.
It uses the rules listed in the comments at the top of that test.
  
This patch introduces these differences from previous behavior;
1)  KEY_BLOCK_SIZE=0 is allowed by Innodb in both strict and non-strict mode
with no errors or warnings. It was previously used by the server to set 
KEY_BLOCK_SIZE to undefined.  (Bug#56628)
2)  An explicit valid non-DEFAULT ROW_FORMAT always takes priority over a
valid KEY_BLOCK_SIZE. (bug#56632)
3)  Automatic use of COMPRESSED row format is only done if the ROW_FORMAT
is DEFAULT or unspecified.
4)  ROW_FORMAT=FIXED is prevented in strict mode.

This patch also includes various formatting changes for consistency with
InnoDB coding standards.

Related Bugs
Bug#54679: ALTER TABLE causes compressed row_format to revert to compact
Bug#56628: ALTER TABLE .. KEY_BLOCK_SIZE=0 produces untrue warning or unnecessary error
Bug#56632: ALTER TABLE implicitly changes ROW_FORMAT to COMPRESSED
2010-11-02 17:28:34 -05:00
Vasil Dimov
49cbbf6ea4 Fix Bug#53046 dict_update_statistics_low can still be run concurrently on same table
Replace the array of mutexes that used to protect
dict_index_t::stat_n_diff_key_vals[] with an array of rw locks that protects
all the stats related members in dict_table_t and all of its indexes.

Approved by:	Jimmy (rb://503)
2010-11-02 18:57:20 +02:00
Vasil Dimov
addb147533 Increment InnoDB Plugin version to 1.0.14.
InnoDB Plugin 1.0.13 has been released with MySQL 5.1.52.
2010-11-02 10:00:04 +02:00
Marko Mäkelä
004bb1b15e Bug#57799 READ UNCOMMITTED access failure of off-page DYNAMIC or COMPRESSED
columns again

This is follow-up to Bug #54358. Not all occurrences of the bug were fixed.
We need to check all calls to btr_copy_externally_stored_field_prefix_low()
and do the right thing when the pointer to the off-page column is null
(full of zero bytes).

It turns out that only the call to btr_copy_externally_stored_field_prefix()
in row_sel_sec_rec_is_for_blob() needs to be changed.

For fetching complete off-page columns rather than prefixes, the function
btr_rec_copy_externally_stored_field() already checks if the pointer
is null (all-zero).  Two of its callers (row_merge_copy_blobs() and
row_sel_fetch_columns()) are never executed as READ COMMITTED and can
rightfully assert that the fetch succeeded.  The third caller,
row_sel_store_mysql_rec(), already does the right thing.

The calls in row_upd_ext_fetch() and trx_undo_page_fetch_ext() must
expect that the off-page column exists. Update and rollback are
locking operations, never READ UNCOMMITTED.
2010-11-02 09:28:48 +02:00
Marko Mäkelä
6c802b3c43 White-space corrections in the InnoDB Plugin ChangeLog 2010-11-02 09:28:05 +02:00
Georgi Kodinov
fd46de026d merge to 5.1-security 2010-10-29 14:02:49 +03:00
Calvin Sun
460ad14e04 Bug#52062: Compiler warning in os0file.c on windows 64-bit
On Windows, the parameter for number of bytes passed into WriteFile()
and ReadFile() is DWORD. Casting is needed to silence the warning on
64-bit Windows.

Also, adding several asserts to ensure the variable for number of bytes
is no more than 32 bits, even on 64-bit Windows.

This is for InnoDB Plugin.

rb://415
Approved by: Inaam
2010-10-28 00:10:28 -05:00
Calvin Sun
16feea4109 Bug#52062: Compiler warning in os0file.c on windows 64-bit
On Windows, the parameter for number of bytes passed into WriteFile()
and ReadFile() is DWORD. Casting is needed to silence the warning on
64-bit Windows.

Also, adding several asserts to ensure the variable for number of bytes
is no more than 32 bits, even on 64-bit Windows.

This is for built-in InnoDB.

rb://415
Approved by: Inaam
2010-10-27 23:18:59 -05:00
Vasil Dimov
4bf273c8f1 Merge mysql-5.1-bugteam -> mysql-5.1-innodb 2010-10-27 16:39:22 +03:00
Inaam Rana
26738c280f Bug #57611 ibdata file and continuous growing undo logs
rb://498

Fix handling of update_undo_logs at trx commit. Previously, when
rseg->update_undo_list grows beyond 500 the update_undo_logs were
marked with state TRX_UNDO_TO_FREE which should have been
TRX_UNDO_TO_PURGE.

Approved by: Sunny Bains
2010-10-26 16:54:18 -04:00
Jimmy Yang
112684b0ba Fix bug #57700 Latching order violation in row_truncate_table_for_mysql().
Approved by Sunny Bains
2010-10-24 22:51:21 -07:00
Jimmy Yang
ed2e88e66c Fix bug #57700 Latching order violation in row_truncate_table_for_mysql().
Approved by Sunny Bains
2010-10-24 20:31:51 -07:00
Jimmy Yang
e8f228e7eb Fix Bug #57616 Sig 11 in dict_load_table() when failed to load
index or foreign key

Approved by Sunny Bains
2010-10-20 19:56:42 -07:00
Jimmy Yang
1e09ea9549 Fix bug #57616 Sig 11 in dict_load_table() when failed to load index
or foreign key

Fix approved by Sunny Bains
2010-10-20 19:14:25 -07:00
Davi Arnaut
3e9c52250a Bug#45288: pb2 returns a lot of compilation warnings
Fix assorted warnings that are generated in optimized builds.
Most of it is silencing variables that are set but unused.

This patch also introduces the MY_ASSERT_UNREACHABLE macro
which helps the compiler to deduce that a certain piece of
code is unreachable.

include/my_compiler.h:
  Use GCC's __builtin_unreachable if available. It allows
  GCC to deduce the unreachability of certain code paths,
  thus avoiding warnings that, for example, accused that a
  variable could be used without being initialized (due to
  unreachable code paths).
2010-10-20 16:21:40 -02:00
Davi Arnaut
7406b38efa Bug#45288: pb2 returns a lot of compilation warnings
Ensure that fdatasync is properly declared as on Mac OS X, the
function is available but there is no prototype. Also, port a
fix for a warning from the InnoDB plugin over to the builtin. 

configure.in:
  Check that fdatasync is declared.
mysys/my_sync.c:
  Use fdatasync only if it is declared.
storage/innobase/include/ut0dbg.h:
  Port over from the plugin a fix for a warning.
2010-10-19 14:48:03 -02:00