Commit graph

63435 commits

Author SHA1 Message Date
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
unknown
06c49d571b Bug#27606 GRANT statement should be replicated with DEFINER information
"Grantor" columns' data is lost when replicating mysql.tables_priv.
Slave SQL thread used its default user ''@'' as the grantor of GRANT|REVOKE
statements executing on it.

In this patch, current user is put in query log event for all GRANT and REVOKE
statement, SQL thread uses the user in query log event as grantor.


mysql-test/suite/rpl/r/rpl_do_grant.result:
  Add test for this bug.
mysql-test/suite/rpl/t/rpl_do_grant.test:
  Add test for this bug.
sql/log_event.cc:
  Refactoring THD::current_user_used and related functions.
  current_user_used is used to judge if current user should be
  binlogged in query log event. So it is better to call it m_binlog_invoker.
  The related functions are renamed too.
sql/sql_class.cc:
  Refactoring THD::current_user_used and related functions.
  current_user_used is used to judge if current user should be
  binlogged in query log event. So it is better to call it m_binlog_invoker.
  The related functions are renamed too.
sql/sql_class.h:
  Refactoring THD::current_user_used and related functions.
  current_user_used is used to judge if current user should be
  binlogged in query log event. So it is better to call it m_binlog_invoker.
  The related functions are renamed too.
sql/sql_parse.cc:
  Call binlog_invoker() for GRANT and REVOKE statements.
2010-10-23 20:55:44 +08:00
Bjorn Munch
909f0bf94a Follow-up to Bug #55582 which allows checking strings in if
Simplified cases where a select was used to compare variable against ''
2010-10-21 15:20:50 +02:00
unknown
6646fecc14 Bug#55478 Row events wrongly apply on the temporary table of the same name
Rows events were applied wrongly on the temporary table with the same name.
But rows events are generated only for base tables. As temporary
table's data never be binlogged on row mode. Normally, base table of the
same name cannot be updated if a temporary table has the same name.
But there are two cases which can generate rows events on 
the base table of same name.
      
Case1: 'CREATE TABLE ... SELECT' statement.
In mixed format, it will generate rows events if it is unsafe.
      
Case2: Drop a transactional temporary table in a transaction
       (happens only on 5.5+).
BEGIN;
DROP TEMPORARY TABLE t1;       # t1 is a InnoDB table
INSERT INTO t1 VALUES(rand()); # t1 is a MyISAM table
COMMIT;
'DROP TEMPORARY TABLE' will be put in the transaction cache and
binlogged after the rows events generated by the 'INSERT' statement.
      
After this patch, slave opens only base table when applying a rows event.
2010-10-21 13:43:19 +08: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
b5bb13ec03 Bug#45288: pb2 returns a lot of compilation warnings
Fix assorted compiler warnings.

include/my_pthread.h:
  Like for pthread_cond_timedwait, the abstime is constant.
mysys/my_gethwaddr.c:
  Instead of using a manual copy that introduce warnings due to
  type mismatch, copy the buffer using memcpy and use memcmp to
  check whether all bytes of the buffer are zeroed.
mysys/thr_mutex.c:
  Like for pthread_cond_timedwait, the abstime is constant.
unittest/mytap/tap.h:
  Introduce a ok() variant that does not take a format argument.
  Since ok() is tagged with a printf attribute, GCC complains if
  the fmt argument is NULL.
2010-10-20 11:40:04 -02:00
Bjorn Munch
e4f9ead140 Fixed wrong feof check in read_line, see 52019 2010-10-20 11:41:51 +02:00
Bjorn Munch
e533c7cc10 Fixed missing cast of arg to my_mbcharlen 2010-10-20 11:39:58 +02:00
Bjorn Munch
f73ada3722 48863 followup: move an array declaration out from within if block 2010-10-20 11:30:50 +02:00
Bjorn Munch
6960db2dfd Bug #52019 main.mysqltest fails on new tests for lowercase_result
Limited to actual bug fix, fixing a while condition
Again confirmed on Linux PPC and on AIX 5.3
2010-10-20 11:22:08 +02:00
Davi Arnaut
1040f98ccf Bug#45288: pb2 returns a lot of compilation warnings
Tag or remove unused arguments and variables.

regex/main.c:
  Use the real prototype.
sql/ha_ndbcluster.cc:
  Make conditions less ambiguous.
2010-10-19 20:36:59 -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
Vasil Dimov
cb01050661 Fix Bug#53916 storage/innodb_plugin does not compile on NetBSD/sparc64
Just check for all the functions that we are going to use, not a subset
of them.

Reviewed by:	Davi (via IRC)
2010-10-19 17:32:26 +03:00
Davi Arnaut
be170c213f Bug#45288: pb2 returns a lot of compilation warnings on linux
Tag unused arguments.
      
Approved by: Marko (via IRC)
2010-10-19 12:12:43 -02:00
Davi Arnaut
8875c2c2e0 Bug#45288: pb2 returns a lot of compilation warnings on linux
Tag unused arguments.

Approved by: Marko (via IRC)
2010-10-19 12:09:28 -02:00
Davi Arnaut
183710558f Bug#45288: pb2 returns a lot of compilation warnings on linux
Fix assorted compiler warnings on Mac OS X.

BUILD/SETUP.sh:
  Remove -Wctor-dtor-privacy flag to workaround a GCC bug that
  causes it to not properly detect that implicitly generated
  constructors are always public.
cmd-line-utils/readline/terminal.c:
  tgetnum and tgetflag might not take a const string argument.
mysys/my_gethostbyname.c:
  Tag unused arguments.
mysys/my_sync.c:
  Tag unused arguments.
2010-10-19 11:49:31 -02:00
Bjorn Munch
05062d579a Bug #56654 pb2 log is very hard to read
Added some more info in a number of fail cases
(re-commit for administrative reasons)
2010-10-19 14:01:14 +02:00
Bjorn Munch
84c57a5e27 Bug #52828 Tests that use perl fail when perl is not in path
main.mysqltest skipped on Windows because a perl intentionally does exit(1)
Use exit(2), as exit(1) on Windows is indistinguishable from failing to
execute perl.
2010-10-19 13:56:30 +02:00
Bjorn Munch
8a67fc8c82 Test wait_timeout: do not fail by SQL syntax error, use die 2010-10-19 13:54:28 +02:00
Magne Mahre
95d91c0f57 Bug #46941 crash with lower_case_table_names=2 and foreign key
data dictionary confusion

On file systems with case insensitive file names, and
lower_case_table_names set to '2', the server could crash
due to a table definition cache inconsistency.  This is 
the default setting on MacOSX, but may also be set and
used on MS Windows.

The bug is caused by using two different strategies for
creating the hash key for the table definition cache, resulting
in failure to look up an entry which is present in the cache,
or failure to delete an existing entry.  One strategy was to
use the real table name (with case preserved), and the other
to use a normalized table name (i.e a lower case version).

This is manifested in two cases.  One is  during 'DROP DATABASE', 
where all known files are removed.  The removal from
the table definition cache is done via a generated list of
TABLE_LIST with keys (wrongly) created using the case preserved 
name.  The other is during CREATE TABLE, where the cache lookup
is also (wrongly) based on the case preserved name.
   
The fix was to use only the normalized table name when
creating hash keys.


sql/sql_db.cc:
  Normalize table name (i.e lower case it)
sql/sql_table.cc:
  table_name contains the normalized name
  alias contains the real table name
2010-10-19 12:27:09 +02:00
Jon Olav Hauglid
4776282bed Bug #57274 SET GLOBAL debug crashes on Solaris in embedded server mode
(variables_debug fails)

The problem was that "SET GLOBAL debug" could cause a crash on Solaris.
The crash happened if the server failed to open the trace file given in 
the "SET GLOBAL debug" statement. This caused an error message to be
printed to stderr containing the process name. However, printing to
stderr crashed the server since the pointer to the process name had
not been initialized.

This patch fixes the problem by initializing the process name 
properly when doing "SET GLOBAL debug".

No test case added as this bug was repeatable with existing test
coverage in variables_debug.test.
2010-10-19 10:19:57 +02:00
Tor Didriksen
af665ea977 Bug#52172 post-push fix: init auto-variable to NULL 2010-10-19 09:06:48 +02:00
Marko Mäkelä
c38071ec18 Bug #56680 wrong InnoDB results from a case-insensitive covering index
row_search_for_mysql(): When a secondary index record might not be
visible in the current transaction's read view and we consult the
clustered index and optionally some undo log records, return the
relevant columns of the clustered index record to MySQL instead of the
secondary index record.

ibuf_insert_to_index_page_low(): New function, refactored from
ibuf_insert_to_index_page().

ibuf_insert_to_index_page(): When we are inserting a record in place
of a delete-marked record and some fields of the record differ, update
that record just like row_ins_sec_index_entry_by_modify() would do.

btr_cur_update_alloc_zip(): Make the function public.

mysql_row_templ_t: Add clust_rec_field_no.

row_sel_store_mysql_rec(), row_sel_push_cache_row_for_mysql(): Add the
flag rec_clust, for returning data at clust_rec_field_no instead of
rec_field_no. Resurrect the debug assertion that the record not be
marked for deletion. (Bug #55626)

[UNIV_DEBUG || UNIV_IBUF_DEBUG] ibuf_debug, buf_page_get_gen(),
buf_flush_page_try():
Implement innodb_change_buffering_debug=1 for evicting pages from the
buffer pool, so that change buffering will be attempted more
frequently.
2010-10-19 09:04:15 +03:00
Marko Mäkelä
a8f2f7af32 Bug #56680 wrong InnoDB results from a case-insensitive covering index
row_search_for_mysql(): When a secondary index record might not be
visible in the current transaction's read view and we consult the
clustered index and optionally some undo log records, return the
relevant columns of the clustered index record to MySQL instead of the
secondary index record.

REC_INFO_DELETED_FLAG: Move the definition from rem0rec.ic to rem0rec.h.

ibuf_insert_to_index_page_low(): New function, refactored from
ibuf_insert_to_index_page().

ibuf_insert_to_index_page(): When we are inserting a record in place
of a delete-marked record and some fields of the record differ, update
that record just like row_ins_sec_index_entry_by_modify() would do.

mysql_row_templ_t: Add clust_rec_field_no.

row_sel_store_mysql_rec(), row_sel_push_cache_row_for_mysql(): Add the
flag rec_clust, for returning data at clust_rec_field_no instead of
rec_field_no. Resurrect the debug assertion that the record not be
marked for deletion. (Bug #55626)

buf_LRU_free_block(): Refactored from
buf_LRU_search_and_free_block(). This is needed for the
innodb_change_buffering_debug diagnostics.

[UNIV_DEBUG || UNIV_IBUF_DEBUG] ibuf_debug, buf_page_get_gen(),
buf_flush_page_try():
Implement innodb_change_buffering_debug=1 for evicting pages from the
buffer pool, so that change buffering will be attempted more
frequently.
2010-10-19 08:58:53 +03:00
Davi Arnaut
5aa81e380c Bug#45288: pb2 returns a lot of compilation warnings on linux
Enable the MySQL maintainer-specific development environment
(which add various warning related options to the compiler
flags) if debugging support is enabled.

config/ac-macros/maintainer.m4:
  Enable the maintainer mode if debug support is enabled.
configure.in:
  Move debug argument to before the maintainer mode check.
2010-10-18 14:27:10 -02:00
Dmitry Shulga
cdddc7bfd5 Follow up for bug#36742. Changed test case for bug#19828
because currently hostname stored in db in lowercase.
2010-10-18 21:03:53 +07:00
Sergey Glukhov
d0ac4e2c5a Bug#56814 Explain + subselect + fulltext crashes server
create_sort_index() function overwrites original JOIN_TAB::type field.
At re-execution of subquery overwritten JOIN_TAB::type(JT_ALL) is
used instead of JT_FT. It misleads test_if_skip_sort_order() and
the function tries to find suitable key for the order that should
not be allowed for FULLTEXT(JT_FT) table.
The fix is to restore JOIN_TAB strucures for subselect on re-execution
for EXPLAIN.
Additional fix:
Update TABLE::maybe_null field which
affects list_contains_unique_index() behaviour as it
could have the value(maybe_null==TRUE) based on the
assumption that this join is outer
(see setup_table_map() func).


mysql-test/r/explain.result:
  test case
mysql-test/t/explain.test:
  test case
sql/item_subselect.cc:
  Make subquery uncacheable in case of EXPLAIN. It allows to keep
  original JOIN_TAB::type(see JOIN::save_join_tab) and restore it
  on re-execution.
sql/sql_select.cc:
  -restore JOIN_TAB strucures for subselect on re-execution for EXPLAIN
  -Update TABLE::maybe_null field as it could have
   the value(maybe_null==TRUE) based on the assumption
   that this join is outer(see setup_table_map() func).
   This change is not related to the crash problem but
   affects EXPLAIN results in the test case.
2010-10-18 16:12:27 +04:00
Tor Didriksen
9074307102 Bug#52172 test binlog.binlog_index needs --skip-core-file to avoid leaving core files
For crash testing: kill the server without generating core file.

include/my_dbug.h
  Use kill(getpid(), SIGKILL) which cannot be caught by signal handlers.
  All DBUG_XXX macros should be no-ops in optimized mode, do that for DBUG_ABORT as well.
sql/handler.cc
  Kill server without generating core.
sql/log.cc
  Kill server without generating core.
2010-10-18 13:24:34 +02:00
Vasil Dimov
78804bc8bd Fix Bug#57252 disabling innobase_stats_on_metadata disables ANALYZE
This is a merge from 5.1/builtin to 5.1/plugin of:

  --------------
  revision-id: vasil.dimov@oracle.com-20101018104811-nwqhg9vav17kl5s1
  committer: Vasil Dimov <vasil.dimov@oracle.com>
  timestamp: Mon 2010-10-18 13:48:11 +0300
  message:
    Fix Bug#57252 disabling innobase_stats_on_metadata disables ANALYZE
    
    In order to fix this bug we need to distinguish whether ha_innobase::info()
    has been called from ::analyze() or not. Rename ::info() to ::info_low()
    and add a boolean parameter that tells whether the call is from ::analyze()
    or not. Create a new simple ::info() that just calls
    ::info_low(false => not called from analyze). From ::analyze() instead of
    ::info() call ::info_low(true => called from analyze).
    
    Approved by:	Jimmy (rb://487)
  --------------
2010-10-18 14:20:16 +03:00
Vasil Dimov
902b13fa57 Fix Bug#57252 disabling innobase_stats_on_metadata disables ANALYZE
In order to fix this bug we need to distinguish whether ha_innobase::info()
has been called from ::analyze() or not. Rename ::info() to ::info_low()
and add a boolean parameter that tells whether the call is from ::analyze()
or not. Create a new simple ::info() that just calls
::info_low(false => not called from analyze). From ::analyze() instead of
::info() call ::info_low(true => called from analyze).

Approved by:	Jimmy (rb://487)
2010-10-18 13:48:11 +03:00
Sergey Glukhov
127c721cef Bug#54484 explain + prepared statement: crash and Got error -1 from storage engine
Subquery executes twice, at top level JOIN::optimize and ::execute stages.
At first execution create_sort_index() function is called and
FT_SELECT object is created and destroyed. HANDLER::ft_handler is cleaned up
in the object destructor and at second execution FT_SELECT::get_next() method
returns error.
The fix is to reinit HANDLER::ft_handler field before re-execution of subquery.


mysql-test/r/fulltext.result:
  test case
mysql-test/t/fulltext.test:
  test case
sql/item_func.cc:
  reinit ft_handler before re-execution of subquery
sql/item_func.h:
  Fixed method name
sql/sql_select.cc:
  reinit ft_handler before re-execution of subquery
2010-10-18 14:47:26 +04:00
Kristofer Pettersson
e4fab954d1 Automerge 2010-10-17 14:59:01 +02:00
Kristofer Pettersson
e548c322c2 Bug#57359 Possible to circumvent secure_file_priv using '..' on Windows
Where realpath(3) is used in Linux, mf_load_path is
used for Windows. This function doesn't however
correspond to the functionality of realpath.
This patch attempts to do better by using 
the Windows function GetFullPathName() instead.
2010-10-17 13:00:13 +02:00
unknown
211552ccee Bug#56118 STOP SLAVE does not wait till trx with CREATE TMP TABLE ends,
replication aborts

When recieving a 'SLAVE STOP' command, slave SQL thread will roll back the
transaction and stop immidiately if there is only transactional table updated,
even through 'CREATE|DROP TEMPOARY TABLE' statement are in it. But These
statements can never be rolled back. Because the temporary tables to the user
session mapping remain until 'RESET SLAVE', Therefore it will abort SQL thread
with an error that the table already exists or doesn't exist, when it restarts
and executes the whole transaction again.

After this patch, SQL thread always waits till the transaction ends and then stops,
if 'CREATE|DROP TEMPOARY TABLE' statement are in it.

mysql-test/extra/rpl_tests/rpl_stop_slave.test:
  Auxiliary file which is used to test this bug.
mysql-test/suite/rpl/t/rpl_stop_slave.test:
  Test case for this bug.
sql/slave.cc:
  Checking if OPTION_KEEP_LOG is set. If it is set, SQL thread should wait
  until the transaction ends.
sql/sql_parse.cc:
  Add a debug point for testing this bug.
2010-10-16 20:03:44 +08:00
Alexey Botchkov
8760cec601 merging. 2010-10-15 20:13:35 +05:00
Vasil Dimov
ef858cc463 Remove leftover conflict marker
It was added in jimmy.yang@oracle.com-20100902004302-m5ax9qo0ne2msdfx
2010-10-15 17:50:45 +03:00
Vasil Dimov
3e56680632 Merge mysql-5.1-bugteam -> mysql-5.1-innodb 2010-10-15 17:38:39 +03:00
Vasil Dimov
74b42d8daa Add InnoDB Plugin ChangeLog entry for Bug#56143 2010-10-15 17:30:32 +03:00
Vasil Dimov
3ce802d5d8 Fix the formatting in storage/innodb_plugin/ChangeLog 2010-10-15 17:26:58 +03:00
Mattias Jonsson
2234783085 merge 2010-10-15 09:27:28 +02:00
Jimmy Yang
27c80dd424 Remove an unused counter variable in io_handler_thread(). 2010-10-14 04:19:52 -07:00
Vasil Dimov
c8163ef1dc Tune the test for Bug#56143 too many foreign keys causes output of show create table to become invalid
Use a CREATE statement with all the FKs instead of ALTERing the table many
times because it is faster (11 seconds vs 3 seconds).
2010-10-14 12:33:56 +03:00
Vasil Dimov
f918ad4381 Fix Bug#56143 too many foreign keys causes output of show create table to become invalid
This is a port of the following changeset from
5.1/storage/innobase to 5.1/storage/innodb_plugin:

  ------------------------------------------------------------
  revno: 3626
  revision-id: vasil.dimov@oracle.com-20101013171859-gi9n558yj89x9v3w
  parent: klewis@mysql.com-20101012175933-ce9kkgl0z8oeqffa
  committer: Vasil Dimov <vasil.dimov@oracle.com>
  branch nick: mysql-5.1-innodb
  timestamp: Wed 2010-10-13 20:18:59 +0300
  message:
    Fix Bug#56143 too many foreign keys causes output of show create table to become invalid
    
    Just remove the check whether the file is "too big".
    A similar code exists in ha_innobase::update_table_comment() but that
    method does not seem to be used.

Also use a CREATE statement with all the FKs instead of ALTERing the
table 550 times because it is faster.
2010-10-14 12:28:25 +03:00
Vasil Dimov
4c14da7975 Fix Bug#56143 too many foreign keys causes output of show create table to become invalid
Just remove the check whether the file is "too big".
A similar code exists in ha_innobase::update_table_comment() but that
method does not seem to be used.
2010-10-13 20:18:59 +03:00
Jimmy Yang
d5055f4e8a Fix Bug #57397 io_handler_thread() will never cleanup
rb://483 approved by Inaam
2010-10-13 21:17:00 -07:00
unknown
895506247d Bug#55632 - Fix testcase for 5.1 plugin 2010-10-13 13:32:10 -05:00
Luis Soares
54c308d37d BUG 55263: automerged bzr bundle from bug report into
latest mysql-5.1-bugteam.
2010-10-13 08:26:50 +01:00
Luis Soares
6739a84529 BUG 38718: automerged bzr bundle from bug report into
latest mysql-5.1-bugteam.
2010-10-13 08:25:43 +01:00