Commit graph

431 commits

Author SHA1 Message Date
Sergei Golubchik
49501b4ccb fix memory leaks and other problems found by safemalloc
client/mysql_upgrade.c:
  missing DBUG_RETURN
client/mysqladmin.cc:
  client plugin memory wasn't freed
client/mysqlcheck.c:
  client plugin memory, defaults, a result set, a command-line option value were not freed.
  missing DBUG_RETURN.
client/mysqldump.c:
  client plugin memory wasn't freed
client/mysqlslap.c:
  client plugin memory wasn't freed
client/mysqltest.cc:
  hopeless. cannot be fixed.
mysql-test/valgrind.supp:
  Bug#56666 is now fixed.
mysys/array.c:
  really, don't allocate if the caller didn't ask to.
mysys/my_init.c:
  safemalloc checks must be done at the very end
mysys/my_thr_init.c:
  not needed anymore
sql-common/client.c:
  memory leak
sql/log.cc:
  log_file was not closed, memory leak.
sql/mysqld.cc:
  fix bug#56666 (causing many P_S related memory leaks).
  close_active_mi() not called for --bootstrap, memory leak.
sql/sql_lex.cc:
  redo Lex->mi handling
sql/sql_lex.h:
  redo Lex->mi handling
sql/sql_plugin.cc:
  plugins having PLUGIN_VAR_MEMALLOC string variables have this variables allocated in every THD.
  The memory was freed in ~THD but only if plugin was still active. If plugin was unloaded the
  variable was not found and the memory was lost. By loading and unloading plugins an arbitrary
  amount of memory can be lost.
sql/sql_repl.cc:
  redo Lex->mi handling
sql/sql_yacc.yy:
  completely wrong handling of Lex->mi - run-time memory leak, by repeating the statement
  arbitrary amount of memory can be lost.
  
  Lex->mi.repl_ignore_server_ids_opt was allocated when parsing CHANGE MASTER,
  and freed after executing the statement. if parser failed on syntax (or another)
  error the statement was never executed. Lex->mi was simply bzero-ed for the next
  CHANGE MASTER  statement.
sql/table.cc:
  didn't compile
storage/perfschema/pfs_lock.h:
  Bug#56666 is fixed
2011-07-10 20:09:17 +02:00
Sergei Golubchik
9809f05199 5.5-merge 2011-07-02 22:08:51 +02:00
Guilhem Bichot
3ceec2f19c Merge from 5.1. 2011-05-21 10:21:08 +02:00
Sergei Golubchik
0accbd0364 lots of post-merge changes 2011-04-25 17:22:25 +02:00
Sven Sandberg
2f9198a0f2 WL#5670: Proposal: Remove SHOW NEW MASTER statement
Removes SHOW NEW MASTER statement and all related code.
Also removes the unused function update_slave_list from repl_failsafe.cc.


mysql-test/r/signal_code.result:
  Updated result file.
  The output of SHOW PROCEDURE CODE has changed, because the numerical values
  of some SQLCOM_ commands have changes. This is not a problem, because
  SHOW PROCEDURE CODE only exists in debug builds and the numerical values of
  SQLCOM_ constants are not exposed elsewhere.
mysql-test/r/sp-code.result:
  Updated result file.
  The output of SHOW PROCEDURE CODE has changed, because the numerical values
  of some SQLCOM_ commands have changes. This is not a problem, because
  SHOW PROCEDURE CODE only exists in debug builds and the numerical values of
  SQLCOM_ constants are not exposed elsewhere.
sql/mysqld.cc:
  Remove SQLCOM_SHOW_NEW_MASTER.
sql/repl_failsafe.cc:
  Remove show_new_master, which was only used by the removed SHOW NEW MASTER statement.
  Remove translate_master, which was only used by show_new_master.
  Remove find_slave_event, which was only used by translate_master.
  Remove find_target_pos, which was only used by translate_master.
  Remove cmp_master_pos, which was only used by translate_master.
  Remove update_slave_list, which was not used at all.
sql/repl_failsafe.h:
  Remove declarations of functions removed by this patch:
    update_slave_list, show_new_master, translate_master, update_slave_list
  
  Remove declarations of functions that did not exist before this patch:
    handle_failsafe_rpl, load_master_data
  
  Remove declaration of function that is static in slave.cc:
    connect_to_master
sql/sp_head.cc:
  Removed SQLCOM_SHOW_NEW_MASTER
sql/sql_lex.h:
  Removed SQLCOM_SHOW_NEW_MASTER
sql/sql_parse.cc:
  Removed SQLCOM_SHOW_NEW_MASTER
sql/sql_repl.cc:
  Removed cmp_master_pos(char*,ulonglong,char*,ulonglong), which was
  only used by cmp_master_pos*Slave_log_event* sev, LEX_MASTER_INFO* mi) in repl_failsafe.cc,
  which has been removed.
sql/sql_repl.h:
  removed cmp_master_pos
sql/sql_yacc.yy:
  removed syntax SHOW NEW MASTER.
2011-02-16 17:27:35 +01:00
Alfranio Correia
235e10d987 BUG#55675 rpl.rpl_log_pos fails sporadically with error binlog truncated in the middle
There are two calls to read_log_event() on master in mysql_binlog_send().
Each call reads 19 bytes in this test case and the error of the second
read_log_event() is reported to the slave.

The second read_log_event() starts from position 94 (75 + 19) to 113
(75 + 19 + 19). Usually, there are two events in the binary log:

    . 0   - 3   - Header
    . 4   - 105 - Format Descriptor Event
    . 106 - 304 - Query Event

and both reads fail because operations are reading from invalid positions
as expected.

However, mysql_binlog_send() does not use the same IO_CACHE that is used to
write into binary log (i.e. mysql_bin_log.log_file) for the hot binary log.
It opens the binary log file directly by calling open_binlog() and creates a
separated IO_CACHE. So there is a possibly that after a master has flushed
the binary log file, the content has been cached by the filesystem, and has
not updated the disk file. If this happens, then a slave will only see part
of the file, and thus the second read_log_event() will report event truncated
error.

To fix the problem, if the first read_log_event() has failed, we ensure that
the second one will try to read from the same position.
2011-01-28 01:25:26 +00:00
unknown
49b7a1f48d Postfix BUG#58546
Updated Copyright.
2011-01-24 11:48:54 +08:00
Libing Song
77bc81b89c Bug#58546 test rpl_packet timeout failure sporadically on PB
rpl_packet got a timeout failure sporadically on PB when stopping
slave. The real reason of this bug is that STOP SLAVE stopped
IO thread first and then stopped SQL thread. It was
possible that IO thread stopped after replicating part of a
transaction which SQL thread was executing. SQL thread would
be hung if the transaction could not be rolled back safely.
            
After this patch, STOP SLAVE will stop SQL thread first and then stop IO
thread, which guarantees that IO thread will fetch the reset of the
events of the transaction that SQL thread is executing, so that SQL
thread can finish the transaction if it cannot be rolled back safely.
            
Added below auxiliary files to make the test code neater.
restart_slave_sql.inc
rpl_connection_master.inc
rpl_connection_slave.inc
rpl_connection_slave1.inc
2011-01-19 01:23:49 +08:00
Alfranio Correia
318bdb6c66 merge mysql-5.1 --> mysql-5.5
Conflicts:
  
  . mysql-test/extra/rpl_tests/rpl_insert_ignore.test
  . mysql-test/suite/rpl/t/disabled.def
  . mysql-test/suite/rpl/t/rpl_insert_ignore.test
  . sql/sql_insert.cc
  . sql/sql_repl.cc
2011-01-31 13:11:05 +00:00
unknown
494e67d3c5 Manual Merge. 2011-01-24 11:52:29 +08:00
Libing Song
16c0933916 Manual merge 2011-01-19 01:38:10 +08:00
Luis Soares
16b2ca1f65 BUG#46166
Post merge fixes for mysql-5.5-bugteam.
2010-12-07 16:55:25 +00:00
Alfranio Correia
eab1def49a BUG#55415 wait_for_update_bin_log enters a condition but does not leave
In sql/log.c, member function wait_for_update_bin_log, a condition is entered with
THD::enter_cond but is not exited. This might leave dangling references to the
mutex/condition in the per-thread information area.
      
To fix the problem, we call exit_cond to properly remove references to the mutex,
LOCK_log.
2010-09-06 18:18:44 +01:00
Alfranio Correia
e297990d5b BUG#55415 wait_for_update_bin_log enters a condition but does not leave
In sql/log.c, member function wait_for_update_bin_log, a condition is entered with
THD::enter_cond but is not exited. This might leave dangling references to the
mutex/condition in the per-thread information area.

To fix the problem, we call exit_cond to properly remove references to the mutex,
LOCK_log.
2010-08-04 23:28:28 +01:00
Sven Sandberg
4e7fa5c4d5 merged BUG#55322 from 5.1-bugteam to trunk-merge 2010-07-26 12:52:59 +02:00
Sven Sandberg
d7c1b752cd merged BUG#55322 to 5.1-bugteam 2010-07-26 11:56:30 +02:00
Davi Arnaut
182599dd13 Merge of mysql-5.1-bugteam into mysql-trunk-merge. 2010-07-20 16:30:10 -03:00
Davi Arnaut
9a5fa17fd3 Bug#45288: pb2 returns a lot of compilation warnings on linux
Fix warnings flagged by the new warning option -Wunused-but-set-variable
that was added to GCC 4.6 and that is enabled by -Wunused and -Wall. The
option causes a warning whenever a local variable is assigned to but is
later unused. It also warns about meaningless pointer dereferences.

client/mysql.cc:
  Meaningless pointer dereferences.
client/mysql_upgrade.c:
  Check whether reading from the file succeeded.
extra/comp_err.c:
  Unused.
extra/yassl/src/yassl_imp.cpp:
  Skip instead of reading data that is discarded.
include/my_pthread.h:
  Variable is only used in debug builds.
include/mysys_err.h:
  Add new error messages.
mysys/errors.c:
  Add new error message for permission related functions.
mysys/mf_iocache.c:
  Variable is only checked under THREAD.
mysys/my_copy.c:
  Raise a error if chmod or chown fails.
mysys/my_redel.c:
  Raise a error if chmod or chown fails.
regex/engine.c:
  Use a equivalent variable for the assert.
server-tools/instance-manager/instance_options.cc:
  Unused.
sql/field.cc:
  Unused.
sql/item.cc:
  Unused.
sql/log.cc:
  Do not ignore the return value of freopen: only set buffer if
  reopening succeeds.
  
  Adjust doxygen comment to the right function.
  
  Pass message lenght to log function.
sql/mysqld.cc:
  Do not ignore the return value of freopen: only set buffer if
  reopening succeeds.
sql/partition_info.cc:
  Unused.
sql/slave.cc:
  No need to set pointer to the address of '\0'.
sql/spatial.cc:
  Unused. Left for historical purposes.
sql/sql_acl.cc:
  Unused.
sql/sql_base.cc:
  Pointers are always set to the same variables.
sql/sql_parse.cc:
  End statement if reading fails.
  
  Store the buffer after it has actually been updated.
sql/sql_repl.cc:
  No need to set pointer to the address of '\0'.
sql/sql_show.cc:
  Put variable under the same ifdef block.
sql/udf_example.c:
  Set null pointer flag appropriately.
storage/csv/ha_tina.cc:
  Meaningless dereferences.
storage/example/ha_example.cc:
  Return the error since it's available.
storage/myisam/mi_locking.c:
  Remove unused and dead code.
2010-07-20 15:07:36 -03:00
Sven Sandberg
689a96fcce BUG#55322: SHOW BINLOG EVENTS increases @@SESSION.MAX_ALLOWED_PACKET
Problem: when SHOW BINLOG EVENTS was issued, it increased the value of
@@session.max_allowed_packet. This allowed a non-root user to increase
the amount of memory used by her thread arbitrarily. Thus, it removes
the bound on the amount of system resources used by a client, so it
presents a security risk (DoS attack).

Fix: it is correct to increase the value of @@session.max_allowed_packet
while executing SHOW BINLOG EVENTS (see BUG 30435). However, the
increase should only be temporary. Thus, the fix is to restore the value
when SHOW BINLOG EVENTS ends.
The value of @@session.max_allowed_packet is also increased in
mysql_binlog_send (i.e., the binlog dump thread). It is not clear if this
can cause any trouble, since normally the client that issues
COM_BINLOG_DUMP will not issue any other commands that would be affected
by the increased value of @@session.max_allowed_packet. However, we
restore the value just in case.


mysql-test/suite/rpl/r/rpl_packet.result:
  update result file
mysql-test/suite/rpl/t/rpl_packet.test:
  Add test that verifies that @@session.max_allowed_packet does not change
  when issuing SHOW BINLOG EVENTS.
  Make previous sub-test clean up.
  Add comments listing the bugs in this test case.
sql/sql_repl.cc:
  Restore the old value of thd->variables.max_allowed_packet at the
  end of mysql_binlog_send and mysql_show_binlog_events.
2010-07-20 17:27:13 +02:00
Davi Arnaut
5641fb64b4 Merge of mysql-5.1-bugteam into mysql-trunk-merge. 2010-07-02 16:38:04 -03:00
Davi Arnaut
0eb26fdfa8 Bug#53445: Build with -Wall and fix warnings that it generates
Apart strict-aliasing warnings, fix the remaining warnings
generated by GCC 4.4.4 -Wall and -Wextra flags.

One major source of warnings was the in-house function my_bcmp
which (unconventionally) took pointers to unsigned characters
as the byte sequences to be compared. Since my_bcmp and bcmp
are deprecated functions whose only difference with memcmp is
the return value, every use of the function is replaced with
memcmp as the special return value wasn't actually being used
by any caller.

There were also various other warnings, mostly due to type
mismatches, missing return values, missing prototypes, dead
code (unreachable) and ignored return values.

BUILD/SETUP.sh:
  Remove flags that are implied by -Wall and -Wextra.
  Do not warn about unused parameters in C++.
BUILD/check-cpu:
  Print only the compiler version instead of verbose banner.
  Although the option is gcc specific, the check was only
  being used for GCC specific checks anyway.
client/mysql.cc:
  bcmp is no longer defined.
client/mysqltest.cc:
  Pass a string to function expecting a format string.
  Replace use of bcmp with memcmp.
cmd-line-utils/readline/Makefile.am:
  Always define _GNU_SOURCE when compiling GNU readline.
  Required to make certain prototypes visible.
cmd-line-utils/readline/input.c:
  Condition for the code to be meaningful.
configure.in:
  Remove check for bcmp.
extra/comp_err.c:
  Use appropriate type.
extra/replace.c:
  Replace use of bcmp with memcmp.
extra/yassl/src/crypto_wrapper.cpp:
  Do not ignore the return value of fgets. Retrieve the file
  position if fgets succeed -- if it fails, the function will
  bail out and return a error.
extra/yassl/taocrypt/include/blowfish.hpp:
  Use a single array instead of accessing positions of the sbox_
  through a subscript to pbox_.
extra/yassl/taocrypt/include/runtime.hpp:
  One definition of such functions is enough.
extra/yassl/taocrypt/src/aes.cpp:
  Avoid potentially ambiguous conditions.
extra/yassl/taocrypt/src/algebra.cpp:
  Rename arguments to avoid shadowing related warnings.
extra/yassl/taocrypt/src/blowfish.cpp:
  Avoid potentially ambiguous conditions.
extra/yassl/taocrypt/src/integer.cpp:
  Do not define type within a anonymous union.
  Use a variable to return a value instead of
  leaving the result in a register -- compiler
  does not know the logic inside the asm.
extra/yassl/taocrypt/src/misc.cpp:
  Define handler for pure virtual functions.
  Remove unused code.
extra/yassl/taocrypt/src/twofish.cpp:
  Avoid potentially ambiguous conditions.
extra/yassl/testsuite/test.hpp:
  Function must have C language linkage.
include/m_string.h:
  Remove check which relied on bcmp being defined -- they weren't
  being used as bcmp is only visible when _BSD_SOURCE is defined.
include/my_bitmap.h:
  Remove bogus helpers which were used only in a few files and
  were causing warnings about dead code.
include/my_global.h:
  Due to G++ bug, always silence false-positive uninitialized
  variables warnings when compiling C++ code with G++.
  Remove bogus helper.
libmysql/Makefile.shared:
  Remove built-in implementation of bcmp.
mysql-test/lib/My/SafeProcess/safe_process.cc:
  Cast pid to largest possible type for a process identifier.
mysys/mf_loadpath.c:
  Leave space of the ending nul.
mysys/mf_pack.c:
  Replace bcmp with memcmp.
mysys/my_bitmap.c:
  Dead code removal.
mysys/my_gethwaddr.c:
  Remove unused variable.
mysys/my_getopt.c:
  Silence bogus uninitialized variable warning.
  Do not cast away the constant qualifier.
mysys/safemalloc.c:
  Cast to expected type.
mysys/thr_lock.c:
  Silence bogus uninitialized variable warning.
sql/field.cc:
  Replace bogus helper with a more appropriate logic which is
  used throughout the code.
sql/item.cc:
  Remove bogus logical condition which always evaluates to TRUE.
sql/item_create.cc:
  Simplify code to avoid signedness related warnings.
sql/log_event.cc:
  Replace use of bcmp with memcmp.
  No need to use helpers for simple bit operations.
sql/log_event_old.cc:
  Replace bmove_align with memcpy.
sql/mysqld.cc:
  Move use declaration of variable to the ifdef block where it
  is used. Remove now-unnecessary casts and arguments.
sql/set_var.cc:
  Replace bogus helpers with simple and classic bit operations.
sql/slave.cc:
  Cast to expected type and silence bogus warning.
sql/sql_class.h:
  Don't use enum values as bit flags, the supposed type safety is
  bogus as the combined bit flags are not a value in the enumeration.
sql/udf_example.c:
  Only declare variable when necessary.
sql/unireg.h:
  Replace use of bmove_align with memcpy.
storage/innobase/os/os0file.c:
  Silence bogus warning.
storage/myisam/mi_open.c:
  Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
  char.
storage/myisam/mi_page.c:
  Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
  char.
strings/bcmp.c:
  Remove built-in bcmp.
strings/ctype-ucs2.c:
  Silence bogus warning.
tests/mysql_client_test.c:
  Use a appropriate type as expected by simple_command().
2010-07-02 15:30:47 -03:00
Luis Soares
fc11d74d13 BUG#53657: Slave crashed with error 22 when trying to lock mutex
at mf_iocache.c, line 1722

The slave crashed while two threads: IO thread and user thread
raced for the same mutex (the append_buffer_lock protecting the
relay log's IO_CACHE). The IO thread was trying to flush the
cache, and for that was grabbing the append_buffer_lock. 

However, the other thread was closing and reopening the relay log
when the IO thread tried to lock. Closing and reopening the log
includes destroying and reinitialising the IO_CACHE
mutex. Therefore, the IO thread tried to lock a destroyed mutex.

We fix this by backporting patch for BUG#50364 which fixed this
bug in mysql server 5.5+. The patch deploys missing
synchronization when flush_master_info is called and the relay
log is flushed by the IO thread. In detail the patch backports
revision (from mysql-trunk):
- luis.soares@sun.com-20100203165617-b1yydr0ee24ycpjm

This patch already includes the post-push fix also in BUG#50364:
- luis.soares@sun.com-20100222002629-0cijwqk6baxhj7gr
2010-05-24 17:43:27 +01:00
Alexey Kopytov
5ef2bdea81 Manual merge of mysql-5.1-bugteam to mysql-trunk-merge.
Conflicts:

Text conflict in mysql-test/r/grant.result
Text conflict in mysql-test/t/grant.test
Text conflict in mysys/mf_loadpath.c
Text conflict in sql/slave.cc
Text conflict in sql/sql_priv.h
2010-05-09 02:03:35 +04:00
Alfranio Correia
819caf8eb8 BUG#43406 CHANGE MASTER TO should log previous state in error log
When issuing a 'CHANGE MASTER TO' statement, key elements of the previous
state, namely the host, port, the master_log_file and the master_log_pos
are dumped into the error log.
2010-05-04 10:17:20 +01:00
Mats Kindahl
23d8586dbf WL#5030: Split and remove mysql_priv.h
This patch:

- Moves all definitions from the mysql_priv.h file into
  header files for the component where the variable is
  defined
- Creates header files if the component lacks one
- Eliminates all include directives from mysql_priv.h
- Eliminates all circular include cycles
- Rename time.cc to sql_time.cc
- Rename mysql_priv.h to sql_priv.h
2010-03-31 16:05:33 +02:00
Alexey Kopytov
d95c1e3b47 Manual merge of mysql-trunk into mysql-trunk-merge.
Conflicts:

Text conflict in client/mysqlbinlog.cc
Text conflict in mysql-test/Makefile.am
Text conflict in mysql-test/collections/default.daily
Text conflict in mysql-test/r/mysqlbinlog_row_innodb.result
Text conflict in mysql-test/suite/rpl/r/rpl_typeconv_innodb.result
Text conflict in mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test
Text conflict in mysql-test/suite/rpl/t/rpl_row_create_table.test
Text conflict in mysql-test/suite/rpl/t/rpl_slave_skip.test
Text conflict in mysql-test/suite/rpl/t/rpl_typeconv_innodb.test
Text conflict in mysys/charset.c
Text conflict in sql/field.cc
Text conflict in sql/field.h
Text conflict in sql/item.h
Text conflict in sql/item_func.cc
Text conflict in sql/log.cc
Text conflict in sql/log_event.cc
Text conflict in sql/log_event_old.cc
Text conflict in sql/mysqld.cc
Text conflict in sql/rpl_utility.cc
Text conflict in sql/rpl_utility.h
Text conflict in sql/set_var.cc
Text conflict in sql/share/Makefile.am
Text conflict in sql/sql_delete.cc
Text conflict in sql/sql_plugin.cc
Text conflict in sql/sql_select.cc
Text conflict in sql/sql_table.cc
Text conflict in storage/example/ha_example.h
Text conflict in storage/federated/ha_federated.cc
Text conflict in storage/myisammrg/ha_myisammrg.cc
Text conflict in storage/myisammrg/myrg_open.c
2010-03-24 18:03:44 +03:00
Alexey Kopytov
074583a730 Manual merge of mysql-5.1-bugteam into mysql-trunk-merge.
Conflicts:

Text conflict in mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test
Text conflict in sql/item_func.cc
2010-03-22 16:28:51 +03:00
Andrei Elkin
c3cd608aef Bug #51648 DBUG_SYNC_POINT is not defined on all platforms and mtr cant pre-check that
DBUG_SYNC_POINT has at least one strong limitation that it's not defined
on all platforms. It has issues cooperating with @@debug.
All in all its functionality is superseded by DEBUG_SYNC facility and
there is no reason to maintain the old less flexible one.

Fixed with adding debug_sync_set_action() function as a facility to set up
a sync-action in the server sources code and re-writing existing simulations
(found 3) to use it.
Couple of tests have been reworked as well.

The patch offers a pattern for setting sync-points in replication threads
where the standard DEBUG_SYNC does not suffice to reach goals.





mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test:
  rewriting the test from GET_LOCK()-based to DEBUG_SYNC-based;
  a pattern of usage DEBUG_SYNC for replication testing is provided.
mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result:
  results are changed.
mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test:
  rewriting the test from GET_LOCK()-based to DEBUG_SYNC-based;
  limiting the test to run only with MIXED binlog-format as the test last
  some 10 secs sensitively contributing to the total of tests run.
mysql-test/suite/rpl/t/rpl_show_slave_running.test:
  rewriting the test from GET_LOCK()-based to DEBUG_SYNC-based.
sql/debug_sync.cc:
  adding debug_sync_set_action() function as a facility to set up
  a sync-action in the server sources code.
sql/debug_sync.h:
  externalizing debug_sync_set_action().
sql/item_func.cc:
  purging sources from DBUG_SYNC_POINT.
sql/mysql_priv.h:
  purging sources from DBUG_SYNC_POINT.
sql/slave.cc:
  rewriting failure simulations to base on DEBUG_SYNC rather than GET_LOCK()-based DBUG_SYNC_POINT.
sql/sql_repl.cc:
  removing an orphan failure simulation line because no counterpart in tests existing.
2010-03-19 11:06:40 +02:00
Alexander Nozdrin
a45ea00b32 Manual merge from mysql-next-mr.
Conflicts:
  - sql/sys_vars.cc
2010-02-05 15:05:37 +03:00
Alexander Nozdrin
44c3e5fc45 Auto-merge from mysql-trunk. 2010-02-05 15:02:03 +03:00
Luis Soares
90a79ca4ad BUG#50364: manual merge to mysql-next-mr-bugfixing.
Conflicts
=========
Text conflict in sql/repl_failsafe.cc

Additional changes
==================
Replace references to pthread_mutex with mysql_mutex
2010-02-03 17:19:58 +00:00
Luis Soares
55aab082a9 BUG#50364: FLUSH LOGS crashes the server (rpl.rpl_heartbeat_basic
fails in PB sporadically)
      
The IO thread can concurrently access the relay log IO_CACHE
while another thread is performing an FLUSH LOGS procedure.
      
FLUSH LOGS closes and reopens the relay log and while doing so it
(re)initializes its IO_CACHE. During this procedure the IO_CACHE
mutex is also reinitialized, which can cause problems if some
other thread (namely the IO THREAD) is concurrently accessing it
at the time .
      
This patch fixes the problem by extending the interface of the
flush_master_info function to also include a second paramater, 
"need_relay_log_lock", stating whether the thread should grab the 
relay log lock or not before actually flushing the relay log. 
Also, IO thread now calls flush_master_info with this flag set 
when it flushes master info with in the event read_event loop.

Finally, we also increase loop time in rpl_heartbeat_basic test 
case, so that the number of calls to flush logs doubles, stressing
this part of the code a little more.

mysql-test/suite/rpl/t/rpl_heartbeat_basic.test:
  Doubled the number of iterations on the FLUSH LOGS loop by
  doubling the time available to perform all iterations.
sql/repl_failsafe.cc:
  Updating flush_master_info call so that it uses two parameters
  instead of one.
sql/rpl_mi.cc:
  Updating flush_master_info call so that it uses two parameters
  instead of one.
sql/rpl_mi.h:
  Changed flush_master_info interface. Now takes a second parameter
  instead of just one. The second parameter is: need_lock_relay_log.
sql/rpl_rli.cc:
  Small fix in comment.
sql/slave.cc:
  Updating flush_master_info call so that it uses two parameters
  instead of one.
sql/sql_repl.cc:
  Updating flush_master_info call so that it uses two parameters
  instead of one.
2010-02-03 16:56:17 +00:00
Alexander Nozdrin
5aa4c33e32 Manual merge from mysql-5.1-bugteam.
Conflicts:
  - sql/mysql_priv.h
2010-01-30 21:47:11 +03:00
Luis Soares
3ad5d21ebc BUG#50780: 'show binary logs' debug assertion when binary
logging is disabled
      
The server would hit an assertion because of a DBUG violation.
There was a missing DBUG_RETURN and instead a plain return
was used.
      
This patch replaces the return with DBUG_RETURN.
2010-02-05 17:51:55 +00:00
Mats Kindahl
e34eb3b507 Patch to eliminate warnings in mysql-next-mr-bugteam. 2010-01-25 22:34:34 +01:00
He Zhenxing
2b16517522 Backport Bug#37148 to 5.1 2010-01-24 15:03:23 +08:00
Alexander Nozdrin
a6667f8577 Manual merge from mysql-trunk-merge.
Conflicts:
  - configure.in
  - include/m_string.h
  - mysql-test/extra/rpl_tests/rpl_row_func003.test
  - mysql-test/r/mysqlbinlog.result
  - mysql-test/r/union.result
  - mysql-test/suite/binlog/r/binlog_killed_simulate.result
  - mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
  - mysql-test/suite/binlog/r/binlog_unsafe.result
  - mysql-test/suite/binlog/t/binlog_unsafe.test
  - mysql-test/suite/rpl/r/rpl_loaddata_fatal.result
  - mysql-test/suite/rpl/r/rpl_loaddata_map.result
  - mysql-test/suite/rpl/r/rpl_stm_loaddata_concurrent.result
  - mysql-test/suite/rpl/r/rpl_stm_log.result
  - mysql-test/suite/rpl/t/rpl_optimize.test
  - mysql-test/t/mysqlbinlog.test
  - mysql-test/t/union.test
  - sql/rpl_utility.h
  - sql/sql_union.cc
  - strings/Makefile.am
2010-01-19 19:36:14 +03:00
Alexey Kopytov
0a5b406fc5 Manual merge from mysql-5.1-bugteam into mysql-trunk-merge.
Conflicts:

Text conflict in .bzr-mysql/default.conf
Text conflict in mysql-test/suite/rpl/r/rpl_loaddata_fatal.result
Text conflict in mysql-test/suite/rpl/r/rpl_stm_log.result
Text conflict in mysql-test/t/mysqlbinlog.test
Text conflict in sql/sql_acl.cc
Text conflict in sql/sql_servers.cc
Text conflict in sql/sql_update.cc
Text conflict in support-files/mysql.spec.sh
2010-01-15 14:26:53 +03:00
Alfranio Correia
b4c0c1550c merge mysql-next-mr --> mysql-5.1-rpl-merge
Conflicts:
  Text conflict in sql/sql_insert.cc
2010-01-14 16:02:55 +00:00
Alfranio Correia
40949a3110 merge mysql-next-mr --> mysql-5.1-rpl-merge
Conflicts:
  Text conflict in sql/log.cc
  Text conflict in sql/slave.cc
  Text conflict in sql/sql_base.cc
2010-01-13 12:22:34 +00:00
unknown
16e15e6952 Manual merge from next-mr. 2010-01-12 20:07:09 +08:00
Marc Alff
e0e0f9e3d4 WL#2360 Performance schema
Part V: performance schema implementation
2010-01-11 18:47:27 -07:00
unknown
c1043021c8 BUG #28421 Infinite loop on slave relay logs
Manually deleteing one or more entries from 'master-bin.index', will
cause master infinitely loop to send one binlog file. 

When starting a dump session, master opens index file and search the binlog file
which is being requested by the slave. The position of the binlog file in the
index file is recorded. it will be used to find the next binlog file when current
binlog file has dumped completely. As only the position is used, it may
not get the correct file if some entries has been removed manually from the index file.
the master will reopen the current binlog file which has been dump completely
and redump it if it can not get the next binlog file's name from index file.
It obviously is a logical error.


Even though it is allowed to manually change index file,
but it is not recommended. so after this patch, master
sends a fatal error to slave and close the dump session if a new binlog file
has been generated and master can not get it from the index file.
2010-01-08 13:42:23 +08:00
Alfranio Correia
5dcb0e447f merge mysql-5.1-rep+2-delivery1 --> mysql-5.1-rpl-merge
Conflicts:

Text conflict in .bzr-mysql/default.conf
Text conflict in mysql-test/extra/rpl_tests/rpl_loaddata.test
Text conflict in mysql-test/r/mysqlbinlog2.result
Text conflict in mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
Text conflict in mysql-test/suite/binlog/r/binlog_unsafe.result
Text conflict in mysql-test/suite/rpl/r/rpl_insert_id.result
Text conflict in mysql-test/suite/rpl/r/rpl_loaddata.result
Text conflict in mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result
Text conflict in mysql-test/suite/rpl/r/rpl_udf.result
Text conflict in mysql-test/suite/rpl/t/rpl_slow_query_log.test
Text conflict in sql/field.h
Text conflict in sql/log.cc
Text conflict in sql/log_event.cc
Text conflict in sql/log_event_old.cc
Text conflict in sql/mysql_priv.h
Text conflict in sql/share/errmsg.txt
Text conflict in sql/sp.cc
Text conflict in sql/sql_acl.cc
Text conflict in sql/sql_base.cc
Text conflict in sql/sql_class.h
Text conflict in sql/sql_db.cc
Text conflict in sql/sql_delete.cc
Text conflict in sql/sql_insert.cc
Text conflict in sql/sql_lex.cc
Text conflict in sql/sql_lex.h
Text conflict in sql/sql_load.cc
Text conflict in sql/sql_table.cc
Text conflict in sql/sql_update.cc
Text conflict in sql/sql_view.cc
Conflict adding files to storage/innobase.  Created directory.
Conflict because storage/innobase is not versioned, but has versioned children.  Versioned directory.
Conflict adding file storage/innobase.  Moved existing file to storage/innobase.moved.
Conflict adding files to storage/innobase/handler.  Created directory.
Conflict because storage/innobase/handler is not versioned, but has versioned children.  Versioned directory.
Contents conflict in storage/innobase/handler/ha_innodb.cc
2010-01-07 15:39:11 +00:00
Marc Alff
3d91522561 WL#2360 Performance schema
Part IV: sql instrumentation
2010-01-06 22:42:07 -07:00
Sergei Golubchik
1ad5bb1a69 WL#4738 streamline/simplify @@variable creation process
Bug#16565 mysqld --help --verbose does not order variablesBug#20413 sql_slave_skip_counter is not shown in show variables
Bug#20415 Output of mysqld --help --verbose is incomplete
Bug#25430 variable not found in SELECT @@global.ft_max_word_len;
Bug#32902 plugin variables don't know their names
Bug#34599 MySQLD Option and Variable Reference need to be consistent in formatting!
Bug#34829 No default value for variable and setting default does not raise error
Bug#34834 ? Is accepted as a valid sql mode
Bug#34878 Few variables have default value according to documentation but error occurs  
Bug#34883 ft_boolean_syntax cant be assigned from user variable to global var.
Bug#37187 `INFORMATION_SCHEMA`.`GLOBAL_VARIABLES`: inconsistent status
Bug#40988 log_output_basic.test succeeded though syntactically false.
Bug#41010 enum-style command-line options are not honoured (maria.maria-recover fails)
Bug#42103 Setting key_buffer_size to a negative value may lead to very large allocations 
Bug#44691 Some plugins configured as MYSQL_PLUGIN_MANDATORY in can be disabled
Bug#44797 plugins w/o command-line options have no disabling option in --help
Bug#46314 string system variables don't support expressions
Bug#46470 sys_vars.max_binlog_cache_size_basic_32 is broken
Bug#46586 When using the plugin interface the type "set" for options caused a crash.
Bug#47212 Crash in DBUG_PRINT in mysqltest.cc when trying to print octal number
Bug#48758 mysqltest crashes on sys_vars.collation_server_basic in gcov builds
Bug#49417 some complaints about mysqld --help --verbose output
Bug#49540 DEFAULT value of binlog_format isn't the default value
Bug#49640 ambiguous option '--skip-skip-myisam' (double skip prefix)
Bug#49644 init_connect and \0
Bug#49645 init_slave and multi-byte characters
Bug#49646 mysql --show-warnings crashes when server dies


CMakeLists.txt:
  Bug#44691 Some plugins configured as MYSQL_PLUGIN_MANDATORY in can be disabled
client/mysql.cc:
  don't crash with --show-warnings when mysqld dies
config/ac-macros/plugins.m4:
  Bug#44691 Some plugins configured as MYSQL_PLUGIN_MANDATORY in can be disabled
include/my_getopt.h:
  comments
include/my_pthread.h:
  fix double #define
mysql-test/mysql-test-run.pl:
  run sys_vars suite by default
  properly recognize envirinment variables (e.g. MTR_MAX_SAVE_CORE) set to 0
  escape gdb command line arguments
mysql-test/suite/sys_vars/r/rpl_init_slave_func.result:
  init_slave+utf8 bug
mysql-test/suite/sys_vars/t/rpl_init_slave_func.test:
  init_slave+utf8 bug
mysys/my_getopt.c:
  Bug#34599 MySQLD Option and Variable Reference need to be consistent in formatting!
  Bug#46586 When using the plugin interface the type "set" for options caused a crash.
  Bug#49640 ambiguous option '--skip-skip-myisam' (double skip prefix)
mysys/typelib.c:
  support for flagset
sql/ha_ndbcluster.cc:
  backport from telco tree
sql/item_func.cc:
  Bug#49644 init_connect and \0
  Bug#49645 init_slave and multi-byte characters
sql/sql_builtin.cc.in:
  Bug#44691 Some plugins configured as MYSQL_PLUGIN_MANDATORY in can be disabled
sql/sql_plugin.cc:
  Bug#44691 Some plugins configured as MYSQL_PLUGIN_MANDATORY in can be disabled
  Bug#32902 plugin variables don't know their names
  Bug#44797 plugins w/o command-line options have no disabling option in --help
sql/sys_vars.cc:
  all server variables are defined here
storage/myisam/ft_parser.c:
  remove unnecessary updates of param->quot
storage/myisam/ha_myisam.cc:
  myisam_* variables belong here
strings/my_vsnprintf.c:
  %o and %llx
unittest/mysys/my_vsnprintf-t.c:
  %o and %llx tests
vio/viosocket.c:
  bugfix: fix @@wait_timeout to work with socket timeouts (vs. alarm thread)
2009-12-22 10:35:56 +01:00
Alexander Nozdrin
988b25cee1 Manual merge from mysql-next-mr.
Conflicts:
  - sql/sql_yacc.yy
2009-12-02 18:50:14 +03:00
Andrei Elkin
0eda48463c Manual resolving for the following files
Text conflict in mysql-test/collections/default.experimental
Text conflict in mysql-test/r/show_check.result
Text conflict in mysql-test/r/sp-code.result
Text conflict in mysql-test/suite/binlog/r/binlog_tmp_table.result
Text conflict in mysql-test/suite/rpl/t/disabled.def
Text conflict in mysql-test/t/show_check.test
Text conflict in mysys/my_delete.c
Text conflict in sql/item.h
Text conflict in sql/item_cmpfunc.h
Text conflict in sql/log.cc
Text conflict in sql/mysqld.cc
Text conflict in sql/repl_failsafe.cc
Text conflict in sql/slave.cc
Text conflict in sql/sql_parse.cc
Text conflict in sql/sql_table.cc
Text conflict in sql/sql_yacc.yy
Text conflict in storage/myisam/ha_myisam.cc

Corrected results for
 stm_auto_increment_bug33029.reject      2009-12-01
		20:01:49.000000000 +0300
       <andrei> @@ -42,9 +42,6 @@
       <andrei>  RETURN i;
       <andrei>  END//
       <andrei>  CALL p1();
       <andrei> -Warnings:
       <andrei> -Note   1592    Statement may not be safe to log in statement
		format.
       <andrei> -Note   1592    Statement may not be safe to log in statement
		format.

There should be indeed no Note present because there is in fact autoincrement 
top-level query in sp() that triggers inserting in yet another auto-inc table.
(todo: alert DaoGang to improve the test).
2009-12-01 21:07:18 +02:00
Andrei Elkin
184d7b0250 mergin 5.1 -> rep+2 -> rep+3. create_table_from_dump issue will be merged on the next step 2009-11-30 20:20:26 +02:00
He Zhenxing
dd383cadec BUG#37148 Most callers of mysql_bin_log.write ignore the return result
This is the non-ndb part of the patch.

The return value of mysql_bin_log.write was ignored by most callers,
which may lead to inconsistent on master and slave if the transaction
was committed while the binlog was not correctly written. If
my_error() is call in mysql_bin_log.write, this could also lead to
assertion issue if my_ok() or my_error() is called after.

This fixed the problem by let the caller to check and handle the
return value of mysql_bin_log.write. This patch only adresses the
simple cases.


mysql-test/include/binlog_inject_error.inc:
  inject binlog write error when doing a query
mysql-test/suite/binlog/t/binlog_write_error.test:
  Simple test case to check if proper error is reported when injecting binlog write errors.
sql/events.cc:
  check return value of mysql_bin_log.write
sql/log.cc:
  check return value of mysql_bin_log.write
sql/log_event.cc:
  check return value of mysql_bin_log.write
sql/log_event_old.cc:
  check return value of mysql_bin_log.write
sql/mysql_priv.h:
  Change write_bin_log to return int instead of void
sql/rpl_injector.cc:
  check return value of writing binlog
sql/sp.cc:
  check return value of writing binlog
sql/sp_head.cc:
  return 1 if writing binlog failed
sql/sql_acl.cc:
  check return value of writing binlog
sql/sql_base.cc:
  check return value of writing binlog
sql/sql_class.h:
  Change binlog_show_create_table to return int
sql/sql_db.cc:
  Change write_to_binlog to return int
  check return value of writing binlog
sql/sql_delete.cc:
  check return value of writing binlog
sql/sql_insert.cc:
  check return value of writing binlog
sql/sql_load.cc:
  check return value of writing binlog
sql/sql_parse.cc:
  check return value of writing binlog
sql/sql_partition.cc:
  check return value of writing binlog
sql/sql_rename.cc:
  check return value of writing binlog
sql/sql_repl.cc:
  check return value of writing binlog
sql/sql_table.cc:
  Change write_bin_log to return int, and return 1 if there was error writing binlog
sql/sql_tablespace.cc:
  check return value of writing binlog
sql/sql_trigger.cc:
  check return value of writing binlog
sql/sql_udf.cc:
  check return value of writing binlog
sql/sql_update.cc:
  check return value of writing binlog
sql/sql_view.cc:
  check return value of writing binlog
2009-11-21 12:28:01 +08:00