Commit graph

949 commits

Author SHA1 Message Date
Alfranio Correia
6d07a87a58 BUG#11877568 - RPL_SEMI_SYNC FAILS IN PB
Currently, rpl_semi_sync is failing in PB due to the warning message:

  "Slave SQL: slave SQL thread is being stopped in the middle of "
  "applying of a group having updated a non-transaction table; "
  "waiting for the group completion ..."

The problem started happening after the fix for BUG#11762407 what was
automatically suppressing some warning messages.

To fix the current issue, we suppress the aforementioned warning message
and exploit the opportunity to make the sentence clearer.
2011-03-16 16:38:30 +00:00
11d2e2ea3e Manual Merge. 2011-01-24 11:52:29 +08:00
245c3f497a Postfix BUG#58546
Updated Copyright.
2011-01-24 11:48:54 +08:00
Libing Song
2d0fcc1d44 Manual merge 2011-01-19 01:38:10 +08:00
Libing Song
5d75729c92 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
Luis Soares
1b94ba5407 BUG#46166
Post merge fixes for mysql-5.5-bugteam.
2010-12-07 16:55:25 +00:00
Luis Soares
5d6e142b2b BUG#46166
Manual merge from mysql-5.1-bugteam into mysql-5.5-bugteam.

Conflicts
=========

Text conflict in sql/log.cc
Text conflict in sql/log.h
Text conflict in sql/slave.cc
Text conflict in sql/sql_parse.cc
Text conflict in sql/sql_priv.h
2010-12-07 16:11:13 +00:00
Luis Soares
aaefb52df8 BUG#46166: MYSQL_BIN_LOG::new_file_impl is not propagating error
when generating new name.
      
If find_uniq_filename returns an error, then this error is not
being propagated upwards, and execution does not report error to
the user (although a entry in the error log is generated).
                  
Additionally, some more errors were ignored in new_file_impl:
- when writing the rotate event
- when reopening the index and binary log file
                  
This patch addresses this by propagating the error up in the
execution stack. Furthermore, when rotation of the binary log
fails, an incident event is written, because there may be a
chance that some changes for a given statement, were not properly
logged. For example, in SBR, LOAD DATA INFILE statement requires
more than one event to be logged, should rotation fail while
logging part of the LOAD DATA events, then the logged data would
become inconsistent with the data in the storage engine.
2010-11-30 23:32:51 +00:00
Jon Olav Hauglid
a2275f0c8f Merge from mysql-5.5-runtime to mysql-5.5-bugteam
No conflicts
2010-11-18 16:01:58 +01:00
Alexander Barkov
fad763a81f Bug#57306 SHOW PROCESSLIST does not display string literals well.
Problem: Extended characters outside of ASCII range where not displayed
properly in SHOW PROCESSLIST, because thd_info->query was always sent as 
system_character_set (utf8). This was wrong, because query buffer
is never converted to utf8 - it is always have client character set.

Fix: sending query buffer using query character set

  @ sql/sql_class.cc
  @ sql/sql_class.h
    Introducing a new class CSET_STRING, a LEX_STRING with character set.
    Adding set_query(&CSET_STRING)
    Adding reset_query(), to use instead of set_query(0, NULL).

  @ sql/event_data_objects.cc
    Using reset_query()

  @ sql/log_event.cc
    Using reset_query()
    Adding charset argument to set_query_and_id().

  @ sql/slave.cc
    Using reset_query().

  @ sql/sp_head.cc
    Changing backing up and restore code to use CSET_STRING.

  @ sql/sql_audit.h
    Using CSET_STRING.
    In the "else" branch it's OK not to use
    global_system_variables.character_set_client.
    &my_charset_latin1, which is set in constructor, is fine
    (verified with Sergey Vojtovich).

  @ sql/sql_insert.cc
    Using set_query() with proper character set: table_name is utf8.

  @ sql/sql_parse.cc
    Adding character set argument to set_query_and_id().
    (This is the main point where thd->charset() is stored
     into thd->query_string.cs, for use in "SHOW PROCESSLIST".)
    Using reset_query().
    
  @ sql/sql_prepare.cc
    Storing client character set into thd->query_string.cs.

  @ sql/sql_show.cc
    Using CSET_STRING to fetch and send charset-aware query information
    from threads.

  @ storage/myisam/ha_myisam.cc
    Using set_query() with proper character set: table_name is utf8.

  @ mysql-test/r/show_check.result
  @ mysql-test/t/show_check.test
    Adding tests
2010-11-18 17:08:32 +03:00
Jon Olav Hauglid
b23c19e82f Merge from mysql-5.5-bugteam to mysql-5.5-runtime
No conflicts
2010-11-17 17:42:28 +01:00
Davi Arnaut
2495e10c11 Merge of mysql-5.1-bugteam into mysql-5.5-bugteam. 2010-11-16 07:45:07 -02:00
Davi Arnaut
80246ac8b8 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.
2010-11-10 19:14:47 -02:00
Davi Arnaut
ae6801eb23 Bug#37780: Make KILL reliable (main.kill fails randomly)
- A prerequisite cleanup patch for making KILL reliable.

The test case main.kill did not work reliably.

The following problems have been identified:

1. A kill signal could go lost if it came in, short before a
thread went reading on the client connection.

2. A kill signal could go lost if it came in, short before a
thread went waiting on a condition variable.

These problems have been solved as follows. Please see also
added code comments for more details.

1. There is no safe way to detect, when a thread enters the
blocking state of a read(2) or recv(2) system call, where it
can be interrupted by a signal. Hence it is not possible to
wait for the right moment to send a kill signal. It has been
decided, not to fix it in the code.  Instead, the test case
repeats the KILL statement until the connection terminates.

2. Before waiting on a condition variable, we register it
together with a synchronizating mutex in THD::mysys_var. After
this, we need to test THD::killed again. At some places we did
only test it in a loop condition before the registration. When
THD::killed had been set between this test and the registration,
we entered waiting without noticing the killed flag. Additional
checks ahve been introduced where required.

In addition to the above, a re-write of the main.kill test
case has been done. All sleeps have been replaced by Debug
Sync Facility synchronization. A couple of sync points have
been added to the server code.

To avoid further problems, if the test case fails in spite of
the fixes, the test case has been added to the "experimental"
list for now.

- Most of the work on this patch is authored by Ingo Struewing
2010-10-22 09:58:09 -02:00
b1b7e534ef Manual merge 2010-10-16 22:20:35 +08:00
131e3e38fd 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.
2010-10-16 20:03:44 +08:00
Luis Soares
a7dc817904 Automerge from mysql-5.1-bugteam into mysql-5.5-bugteam. 2010-10-13 11:08:39 +01:00
Luis Soares
5f31581fff BUG 55263: automerged bzr bundle from bug report into
latest mysql-5.1-bugteam.
2010-10-13 08:26:50 +01:00
a667ce8e27 Manual merge 2010-10-09 18:18:16 +08:00
b66825912a Bug#55375 Transaction bigger than max_binlog_cache_size crashes slave
When slave executes a transaction bigger than slave's max_binlog_cache_size,
slave will crash. It is caused by the assert that server should only roll back
the statement but not the whole transaction if the error ER_TRANS_CACHE_FULL 
happens. But slave sql thread always rollbacks the whole transaction when
an error happens.
            
Ather this patch, we always clear any error set in sql thread(it is different
from the error in 'SHOW SLAVE STATUS') and it is cleared before rolling back
the transaction.
2010-10-09 15:05:43 +08:00
Luis Soares
f17cc60413 BUG#55263: assert in check_binlog_magic
The procedure for setting up a fake binary log, by changing the
relay log files manually, is run twice when we issue mtr with
--repeat=2. However, when setting it up for the second time,
neither the sql thread is reset nor the server is restarted. This
means that previous stale relay log IO_CACHE metadata - from 
first run - is left around. As a consequence, when the test is 
run for the second time, the IO_CACHE for the relay log has 
position in file different than zero, triggering the assertion.
            
We fix this by deploying a call to my_b_seek before calling
check_binlog_magic in next_event. This prevents the server 
from asserting, in the cases that the SQL thread was reads
from a hot log (relay.NNNNN), then is stopped, then is restarted 
from a previous cold log (relay.MMMMM), and then it reaches 
the hot log relay.NNNNN again, in which case, the read 
coordinates are not set to zero, but to the old values.

Additionally, some comments to the source code were added.
2010-09-24 10:44:53 +01:00
Alexander Nozdrin
dfc63866eb Auto-merge from mysql-trunk-merge. 2010-07-29 16:32:11 +04:00
Konstantin Osipov
2abe7b9d4e Merge trunk-bugfixing -> trunk-runtime. 2010-07-27 18:32:42 +04:00
Konstantin Osipov
ec2c3bf2c1 A pre-requisite patch for the fix for Bug#52044.
This patch also fixes Bug#55452 "SET PASSWORD is
replicated twice in RBR mode".

The goal of this patch is to remove the release of 
metadata locks from close_thread_tables().
This is necessary to not mistakenly release
the locks in the course of a multi-step
operation that involves multiple close_thread_tables()
or close_tables_for_reopen().

On the same token, move statement commit outside 
close_thread_tables().

Other cleanups:
Cleanup COM_FIELD_LIST.
Don't call close_thread_tables() in COM_SHUTDOWN -- there
are no open tables there that can be closed (we leave
the locked tables mode in THD destructor, and this
close_thread_tables() won't leave it anyway).

Make open_and_lock_tables() and open_and_lock_tables_derived()
call close_thread_tables() upon failure.
Remove the calls to close_thread_tables() that are now
unnecessary.

Simplify the back off condition in Open_table_context.

Streamline metadata lock handling in LOCK TABLES 
implementation.

Add asserts to ensure correct life cycle of 
statement transaction in a session.

Remove a piece of dead code that has also become redundant
after the fix for Bug 37521.
2010-07-27 14:25:53 +04:00
Davi Arnaut
dd14fa18af WL#5498: Remove dead and unused source code
Remove unused variables.
2010-07-23 17:13:36 -03:00
Davi Arnaut
9fd9857e0b WL#5498: Remove dead and unused source code
Remove code that has been disabled for a long time.
2010-07-23 17:09:27 -03:00
Davi Arnaut
6c15f6718f Merge of mysql-5.1-bugteam into mysql-trunk-merge. 2010-07-20 16:30:10 -03:00
Davi Arnaut
c96b249fc3 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.
2010-07-20 15:07:36 -03:00
Davi Arnaut
649390ac81 Merge of mysql-trunk-bugfixing into mysql-trunk-merge. 2010-07-15 10:47:50 -03:00
Davi Arnaut
e1f748c0bd Merge of mysql-5.1-bugteam into mysql-trunk-merge. 2010-07-09 09:28:51 -03:00
Davi Arnaut
a10ae35328 Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled
Essentially, the problem is that safemalloc is excruciatingly
slow as it checks all allocated blocks for overrun at each
memory management primitive, yielding a almost exponential
slowdown for the memory management functions (malloc, realloc,
free). The overrun check basically consists of verifying some
bytes of a block for certain magic keys, which catches some
simple forms of overrun. Another minor problem is violation
of aliasing rules and that its own internal list of blocks
is prone to corruption.

Another issue with safemalloc is rather the maintenance cost
as the tool has a significant impact on the server code.
Given the magnitude of memory debuggers available nowadays,
especially those that are provided with the platform malloc
implementation, maintenance of a in-house and largely obsolete
memory debugger becomes a burden that is not worth the effort
due to its slowness and lack of support for detecting more
common forms of heap corruption.

Since there are third-party tools that can provide the same
functionality at a lower or comparable performance cost, the
solution is to simply remove safemalloc. Third-party tools
can provide the same functionality at a lower or comparable
performance cost. 

The removal of safemalloc also allows a simplification of the
malloc wrappers, removing quite a bit of kludge: redefinition
of my_malloc, my_free and the removal of the unused second
argument of my_free. Since free() always check whether the
supplied pointer is null, redudant checks are also removed.

Also, this patch adds unit testing for my_malloc and moves
my_realloc implementation into the same file as the other
memory allocation primitives.
2010-07-08 18:20:08 -03:00
Davi Arnaut
74283a052e Merge of mysql-5.1-bugteam into mysql-trunk-merge. 2010-07-02 16:38:04 -03:00
Davi Arnaut
93fb8bb235 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.
2010-07-02 15:30:47 -03:00
Konstantin Osipov
41d95c5049 A pre-requisite for WL#5419 "LOCK_open scalability:
make tdc_refresh_version an 
atomic counter".
Backport the trivial changes from mysql-trunk-iplus.
2010-06-10 15:43:32 +04:00
Luis Soares
92064b8116 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
ad43230e3b 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
ee36464703 BUG#43407 SET GLOBAL SQL_SLAVE_SKIP_COUNTER should log previous state in error log
When issuing a 'SET GLOBAL SQL_SLAVE_SKIP_COUNTER' statement, the previous
position along with the new position is dumped into the error log. Namely,
the following information is printed out: skip_counter, group_relay_log_name
and group_relay_log_pos.
2010-05-04 10:41:28 +01:00
Mats Kindahl
e409d6f69c 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
f10885675c 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
7ac059ba8f 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
30df18909c 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.
2010-03-19 11:06:40 +02:00
Alexey Kopytov
d2452095a5 Manual merge of mysql-5.1-bugteam into mysql-trunk-merge.
Conflicts:

Text conflict in .bzr-mysql/default.conf
Text conflict in mysql-test/r/explain.result
Text conflict in mysql-test/r/having.result
Text conflict in mysql-test/suite/rpl/t/disabled.def
Text conflict in mysql-test/suite/rpl/t/rpl_slave_skip.test
Text conflict in storage/federated/ha_federated.cc
2010-03-07 19:40:59 +03:00
Andrei Elkin
c23aee47b1 Bug #51089 SHOW STATUS LIKE 'Slave_running' is not compatible with `SHOW SLAVE STATUS'
backporting of bug@30703 to 5.1.
The fixes are backed up with a regression test.
2010-02-25 12:39:43 +02:00
Jon Olav Hauglid
dd42aab840 Followup to Bug#45225 Locking: hang if drop table with no timeout
This patch prevents system threads and system table accesses from
using user-specified values for "lock_wait_timeout". Instead all
such accesses are done using the default value (1 year).

This prevents background tasks (such as replication, events, 
accessing stored function definitions, logging, reading time-zone
information, etc.) from failing in cases where the global value
of "lock_wait_timeout" is set very low.

The patch also simplifies the open tables API. Rather than adding
another convenience function for opening and locking system tables,
this patch removes most of the existing convenience functions for
open_and_lock_tables_derived(). Before, open_and_lock_tables() was
a convenience function that enforced derived tables handling, while
open_and_lock_tables_derived() was the main function where derived
tables handling was optional. Now, this convencience function is
gone and the main function is renamed to open_and_lock_tables(). 

No test case added as it would have required the use of --sleep to
check that system threads and system tables have a different timeout
value from the user-specified "lock_wait_timeout" system variable.
2010-02-24 18:04:00 +01:00
Luis Soares
d9da901092 BUG#50364: Automerge from mysql-trunk-bugfixing. 2010-02-22 00:27:46 +00:00
Luis Soares
1e638e728a Post-push fix for BUG#50364.
There was an erroneous parameter when calling flush_master_info
from write_ignored_events_info_to_relay_log which could lead to a
server crash. This happens because the I/O thread releases the
log_lock before calling the flush_master_info.

Set the function to call flush_master_info with third parameter
to true, so that the mutex is properly taken.
2010-02-22 00:26:29 +00:00
Alexander Nozdrin
6c32fa7357 Manual merge from mysql-next-mr.
Conflicts:
  - sql/log_event.cc
  - sql/sql_class.h
2010-02-15 14:16:49 +03:00
Konstantin Osipov
ad0f1f8021 Merge next-mr -> next-4284. 2010-02-05 01:08:08 +03:00
Konstantin Osipov
89269e5142 Merge next-mr -> next-4284-merge. 2010-02-04 20:34:15 +03:00
Luis Soares
6dd801d7b7 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