Commit graph

600 commits

Author SHA1 Message Date
Andrei Elkin
6b39bb5eac merging from 5.0-bt rep to a local branch 2009-04-30 15:41:47 +03:00
Andrei Elkin
e02d162f79 Bug #38694 Race condition in replication thread shutdown
The issue of the current bug is unguarded access to mi->slave_running 
by the shutdown thread calling end_slave() that is bug#29968 
(alas happened not to be cross-linked with the current bug)

Fixed:

with removing the unguarded read of the running status
and perform reading it in terminate_slave_thread()
at time run_lock is taken (mostly bug#29968 backporting, still with some
improvements over that patch - see the error reporting from 
terminate_slave_thread()).
Issue of bug#38716 is fixed here for 5.0 branch as well.

Note:

There has been a separate artifact identified - 
a race condition between init_slave() and  end_slave() - 
reported as  Bug#44467.
2009-04-28 14:46:07 +03:00
Alexey Botchkov
8dafd2b95d merging 2009-04-28 14:48:54 +05:00
Ignacio Galarza
2b85c64d65 Bug#29125 Windows Server X64: so many compiler warnings
- Remove bothersome warning messages.  This change focuses on the warnings 
that are covered by the ignore file: support-files/compiler_warnings.supp.
- Strings are guaranteed to be max uint in length
2009-02-10 17:47:54 -05:00
Alexey Botchkov
52989c445f Bug#25058 ignored return codes in memory allocation functions
memory allocation error checks added for functions
   calling insert_dynamic()

per-file messages:
  myisam/mi_delete.c
Bug#25058 ignored return codes in memory allocation functions
    out-of-memory errors handled
  myisam/mi_write.c
Bug#25058 ignored return codes in memory allocation functions
    out-of-memory errors handled
  server-tools/instance-manager/instance_options.cc
Bug#25058 ignored return codes in memory allocation functions
    out-of-memory errors handled
  sql/slave.cc
Bug#25058 ignored return codes in memory allocation functions
    out-of-memory errors handled
  sql/sp_head.cc
Bug#25058 ignored return codes in memory allocation functions
    out-of-memory errors handled
  sql/sp_head.h
Bug#25058 ignored return codes in memory allocation functions
    out-of-memory errors handled
  sql/sp_pcontext.cc
Bug#25058 ignored return codes in memory allocation functions
    out-of-memory errors handled
  sql/sp_pcontext.h
Bug#25058 ignored return codes in memory allocation functions
    out-of-memory errors handled
  sql/sql_select.cc
Bug#25058 ignored return codes in memory allocation functions
    out-of-memory errors handled
  sql/sql_yacc.yy
Bug#25058 ignored return codes in memory allocation functions
    out-of-memory errors handled
2008-11-21 17:38:42 +04:00
iggy@amd64.(none)
b9877b84ac Merge amd64.(none):/src/mysql-5.0-bugteam
into  amd64.(none):/src/bug26243/my50-bug26243
2008-03-28 16:01:05 -04:00
iggy@amd64.(none)
79e434bc67 Bug#26243 mysql command line crash after control-c
- Backported the 5.1 DBUG to 5.0.
- Avoid memory cleanup race on Windows client for CTRL-C
2008-03-28 14:02:27 -04:00
istruewing@stella.local
fde9b55d61 Merge stella.local:/home2/mydev/mysql-5.0-amain
into  stella.local:/home2/mydev/mysql-5.0-axmrg
2008-03-26 09:33:55 +01:00
sven@riska.(none)
1322371fb2 BUG#31024: STOP SLAVE does not stop attempted connect()s
Problem: if the IO slave thread is attempting to connect,
STOP SLAVE waits for the attempt to finish. 
It may take a long time.
Fix: don't wait, stop the slave immediately.
2008-03-11 14:42:54 +01:00
aelkin/andrei@mysql1000.(none)
122fefc593 Bug#26622 MASTER_POS_WAIT does not work as documented
MASTER_POS_WAIT return values are different than expected when the server is not a slave. 
It returns -1 instead of NULL.

Fixed with correcting  st_relay_log_info::wait_for_pos() to return the proper
value in the case of rli info is not inited.
2008-03-06 14:49:21 +02:00
svoj@mysql.com/june.mysql.com
fe3b1c8e25 BUG#13861 - START SLAVE UNTIL may stop 1 evnt too late if
log-slave-updates and circul repl

Slave SQL thread may execute one extra event when there are events
skipped by slave I/O thread (e.g. originated by the same server).
Whereas it was requested not to do so by the UNTIL condition.

This happens because we compare with the end position of previously
executed event. This is fine when there are no skipped by slave I/O
thread events, as end position of previous event equals to start
position of to be executed event. Otherwise this position equals to
start position of skipped event.

This is fixed by:
- reading the event to be executed before checking if the until condition
  is satisfied.
- comparing the start position of the event to be executed. Since we do
  not have the start position available, we compute it by subtracting
  event length from end position (which is available).
- if there are no events on the event queue at the slave sql starting
  time, that meet until condition, we stop immediately, as in this
  case we do not want to wait for next event.
2008-02-22 19:07:07 +04:00
aelkin/andrei@mysql1000.dsl.inet.fi
f5fe34dcd1 Merge aelkin@bk-internal.mysql.com:/home/bk/mysql-5.0-rpl
into  mysql1000.dsl.inet.fi:/home/andrei/MySQL/MERGE/5.0-bug33931-assert_write_ignored_ev_when_init_slave_fails
2008-02-14 13:55:11 +02:00
aelkin/andrei@mysql1000.dsl.inet.fi
22072c5c57 Bug #33931 assertion at write_ignored_events_info_to_relay_log if init_slave_thread() fails
and
bug#33932  assertion at handle_slave_sql if init_slave_thread() fails

the asserts were caused by 
  bug33931: having thd deleted at time of executing err: code plus
            a missed initialization;
  bug33932: initialization of slave_is_running member was missed;

fixed with relocating mi members initialization and removing delete thd
It is safe to do as deletion happens later explicitly in the caller of
init_slave_thread().

Todo: at merging the test is better to be moved into suite/bugs for 5.x (when x>0).
2008-02-13 14:09:41 +02:00
aelkin/elkin@koti.dsl.inet.fi
51b33ea35d Bug #34305 show slave status handling segfaults when slave io is about
to leave

The artifact was caused by
a flaw in concurrent accessing the slave's io thd by
the io itself and a handling show slave status thread.
Namely, show_master_info did not acquire mi->run_lock mutex that is
specified for mi->io_thd member.

Fixed with deploying the mutex locking and unlocking. The mutex is kept
short time and without interleaving with mi->data_lock mutex.

Todo: to report and fix an issue with 
    sys_var_slave_skip_counter::{methods} 
seem to acquire incorrectly
     active_mi->rli.run_lock
instead of the specified
     active_mi->rli.data_lock

A test case is difficult to compose, so rpl_packet should continue serving
as the indicator.
2008-02-05 17:36:26 +02:00
mats@capulet.kindahl.net
f1c32705f1 BUG#12691 (Exec_master_log_pos corrupted with SQL_SLAVE_SKIP_COUNTER):
Complementary patch since LOAD DATA INFILE was not covered in
the previous patch.

This patch adds a check so that the slave skip counter is not
decreased to zero if seeing a BEGIN_LOAD_QUERY_EVENT,
APPEND_BLOCK_EVENT, or CREATE_FILE_EVENT since these cannot
end a group. The group is terminated by an EXECUTE_LOAD_QUERY_
EVENT or DELETE_FILE_EVENT.
2007-12-20 16:07:54 +01:00
mats@kindahl-laptop.dnsalias.net
87fd52cd8c Merge kindahl-laptop.dnsalias.net:/home/bkroot/mysql-5.0-rpl
into  kindahl-laptop.dnsalias.net:/home/bk/b12691-mysql-5.0-rpl
2007-10-26 19:18:02 +02:00
mats@kindahl-laptop.dnsalias.net
83cfdff638 BUG#12691 (Exec_master_log_pos corrupted with SQL_SLAVE_SKIP_COUNTER):
Adding code to keep skipping events while inside a transaction. Execution
will start just after the transaction has been skipped.
2007-10-26 18:52:58 +02:00
aelkin/elkin@koti.dsl.inet.fi
501cce2b33 Bug #29309 Incorrect "Seconds_Behind_Master" value in SHOW SLAVE STATUS after FLUSH LOGS
Report claims that Seconds_behind_master behaves unexpectedly. 

Code analysis shows that there is an evident flaw in that treating of FormatDescription event is wrong
so  that after FLUSH LOGS on slave the Seconds_behind_master's calculation slips and incorrect
value can be reported to SHOW SLAVE STATUS. 
Even worse is that the gap between the correct and incorrect deltas grows with time.

Fixed with prohibiting changes to rpl->last_master_timestamp by artifical events (any kind of).
suggestion as comments is added how to fight with lack of info on the slave side by means of
new heartbeat feature coming.

The test can not be done ealily fully determistic.
2007-10-04 18:46:31 +03:00
rafal@quant.(none)
69c529bef1 Merge quant.(none):/ext/mysql/bkroot/mysql-5.0-rpl
into  quant.(none):/ext/mysql/bk/mysql-5.0-bug21132
2007-08-29 15:57:04 +02:00
kaa@polly.local
43286bf4a5 Merge polly.local:/home/kaa/src/maint/bug24192/my50-bug24192
into  polly.local:/home/kaa/src/maint/mysql-5.0-maint
2007-07-11 19:29:11 +04:00
kaa@polly.local
b270fa6736 Fix for bug #24192 "MySQL replication does not exit server when running out of memory"
In case of out-of-memory error received from the master, print the corresponding message to the error log and stop slave I/O thread to avoid reconnecting with a wrong binary log position.
2007-07-11 18:38:45 +04:00
malff/marcsql@weblab.(none)
575eeda804 Merge malff@bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into  weblab.(none):/home/marcsql/TREE/mysql-5.0-25411_d
2007-04-24 09:25:54 -06:00
malff/marcsql@weblab.(none)
fc809c70cc Bug#25411 (trigger code truncated), PART I
The issue found with bug 25411 is due to the function skip_rear_comments()
which damages the source code while implementing a work around.
The root cause of the problem is in the lexical analyser, which does not
process special comments properly.
For special comments like :
[1] aaa /*!50000 bbb */ ccc
since 5.0 is a version older that the current code, the parser is in lining
the content of the special comment, so that the query to process is
[2] aaa bbb ccc
However, the text of the query captured when processing a stored procedure,
stored function or trigger (or event in 5.1), can be after rebuilding it:
[3] aaa bbb */ ccc
which is wrong.

To fix bug 25411 properly, the lexical analyser needs to return [2] when
in lining special comments.
In order to implement this, some preliminary cleanup is required in the code,
which is implemented by this patch.

Before this change, the structure named LEX (or st_lex) contains attributes
that belong to lexical analysis, as well as attributes that represents the
abstract syntax tree (AST) of a statement.
Creating a new LEX structure for each statements (which makes sense for the
AST part) also re-initialized the lexical analysis phase each time, which
is conceptually wrong.

With this patch, the previous st_lex structure has been split in two:
- st_lex represents the Abstract Syntax Tree for a statement. The name "lex"
has not been changed to avoid a bigger impact in the code base.
- class lex_input_stream represents the internal state of the lexical
  analyser, which by definition should *not* be reinitialized when parsing
  multiple statements from the same input stream.

This change is a pre-requisite for bug 25411, since the implementation of
lex_input_stream will later improve to deal properly with special comments,
and this processing can not be done with the current implementation of
sp_head::reset_lex and sp_head::restore_lex, which interfere with the lexer.

This change set alone does not fix bug 25411.
2007-04-24 09:24:21 -06:00
mats@romeo.(none)
fd24cdf91c BUG#26551 (Aborted query for non-transactional table breaks replication):
Added error code ER_QUERY_INTERRUPTED to the list of special errors
that prevent the slave from starting to execute a query.
2007-04-12 14:00:45 +02:00
kaa@polly.local
41992a2729 Merge polly.local:/tmp/maint/bug23775/my50-bug23775
into  polly.local:/home/kaa/src/maint/mysql-5.0-maint
2007-03-20 17:27:49 +03:00
kaa@polly.local
55be09c0ee Fix for bug #23775 "Replicated event larger that max_allowed_packet infinitely re-transmits".
Problem: to handle a situation when the size of event on the master is greater than max_allowed_packet on slave, we checked for the wrong constant (ER_NET_PACKET_TOO_LARGE instead of CR_NET_PACKET_TOO_LARGE).

Solution: test for the client "packet too large" error code instead of the server one in slave I/O thread.
2007-03-16 17:25:20 +03:00
rafal@quant.(none)
536d857d95 Removing two more compilation warnings. 2007-03-01 10:40:48 +01:00
rafal@quant.(none)
235ca912d8 Merge quant.(none):/ext/mysql/bkroot/mysql-5.0-rpl
into  quant.(none):/ext/mysql/bk/mysql-5.0-bug25306
2007-02-27 19:38:39 +01:00
lars/lthalmann@mysql.com/dl145j.mysql.com
1a09fb81fc Merge mysql.com:/nfsdisk1/lars/bkroot/mysql-5.0-rpl
into  mysql.com:/nfsdisk1/lars/MERGE/mysql-5.0-merge
2007-02-25 00:10:51 +01:00
lars/lthalmann@mysql.com/dl145h.mysql.com
1777f04e39 Merge mysql.com:/nfsdisk1/lars/bkroot/mysql-5.0-rpl
into  mysql.com:/nfsdisk1/lars/MERGE/mysql-5.0-merge
2007-02-24 11:41:31 +01:00
gbichot@dl145h.mysql.com
44c6c4cc05 the fix for BUG#24432
"INSERT... ON DUPLICATE KEY UPDATE skips auto_increment values"
didn't make it into 5.0.36 and 5.1.16,
so we need to adjust the bug-detection-based-on-version-number code.
Because the rpl tree has a too old version, rpl_insert_id cannot pass,
so I disable it (like is already the case in 5.1-rpl for the same reason),
and the repl team will re-enable it when they merge 5.0 and 5.1 into
their trees (thus getting the right version number).
2007-02-23 15:32:51 +01:00
rafal@quant.(none)
d6e5e3d367 Merge quant.(none):/ext/mysql/bkroot/mysql-5.0-rpl
into  quant.(none):/ext/mysql/bk/mysql-5.0-bug25306
2007-02-23 01:28:24 +01:00
monty@mysql.com/narttu.mysql.fi
26aa385bc5 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/my/mysql-5.0
2007-02-21 14:07:08 +02:00
guilhem@gbichot3.local
b3a03dada9 Fix for BUG#24432
"INSERT... ON DUPLICATE KEY UPDATE skips auto_increment values".
When in an INSERT ON DUPLICATE KEY UPDATE, using
an autoincrement column, we inserted some autogenerated values and
also updated some rows, some autogenerated values were not used
(for example, even if 10 was the largest autoinc value in the table
at the start of the statement, 12 could be the first autogenerated
value inserted by the statement, instead of 11). One autogenerated
value was lost per updated row. Led to exhausting the range of the
autoincrement column faster.
Bug introduced by fix of BUG#20188; present since 5.0.24 and 5.1.12.
This bug breaks replication from a pre-5.0.24 master.
But the present bugfix, as it makes INSERT ON DUP KEY UPDATE
behave like pre-5.0.24, breaks replication from a [5.0.24,5.0.34]
master to a fixed (5.0.36) slave! To warn users against this when
they upgrade their slave, as agreed with the support team, we add
code for a fixed slave to detect that it is connected to a buggy
master in a situation (INSERT ON DUP KEY UPDATE into autoinc column)
likely to break replication, in which case it cannot replicate so
stops and prints a message to the slave's error log and to SHOW SLAVE
STATUS.
For 5.0.36->[5.0.24,5.0.34] replication we cannot warn as master
does not know the slave's version (but we always recommended to users
to have slave at least as new as master).
As agreed with support, I'll also ask for an alert to be put into
the MySQL Network Monitoring and Advisory Service.
2007-02-08 15:53:14 +01:00
ramil/ram@mysql.com/myoffice.izhnet.ru
47ae650a57 Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into  mysql.com:/usr/home/ram/work/bug10798/my50-bug10798
2007-02-05 10:09:31 +04:00
ramil/ram@mysql.com/myoffice.izhnet.ru
b0977714a8 Merge mysql.com:/usr/home/ram/work/bug10798/my41-bug10798
into  mysql.com:/usr/home/ram/work/bug10798/my50-bug10798
2007-02-05 09:54:23 +04:00
rafal@quant.(none)
b50f3c3149 BUG#25306 (Race conditions during replication slave shutdown (valgrind stacks)):
The possibility of the race is removed by changing sequence of calls

  pthread_mutex_unlock(&mi->run_lock);
  pthread_cond_broadcast(&mi->stop_cond);  

into

  pthread_cond_broadcast(&mi->stop_cond);
  pthread_mutex_unlock(&mi->run_lock);

at the end of I/O thread (similar change at the end of SQL thread). This ensures 
that no thread waiting on the condition executes between the broadcast and the 
unlock and thus can't delete the mi structure which caused the bug.
2007-02-03 20:14:16 +01:00
msvensson@pilot.mysql.com
007d170ad2 Merge pilot.mysql.com:/home/msvensson/mysql/bug22943/my41-bug22943
into  pilot.mysql.com:/home/msvensson/mysql/bug22943/my50-bug22943
2007-01-29 14:33:53 +01:00
msvensson@pilot.mysql.com
7eaa82ea38 Bug#22943 syscall pruning in libmysql
- Set the timeout values only where needed
2007-01-29 14:31:48 +01:00
monty@mysql.com/narttu.mysql.fi
a04157fbb3 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/my/mysql-5.0
2007-01-22 14:04:40 +02:00
kent@mysql.com/kent-amd64.(none)
226a5c833f Many files:
Changed header to GPL version 2 only
2006-12-23 20:17:15 +01:00
ramil/ram@mysql.com/myoffice.izhnet.ru
24f4739846 Fix for bug #10798: If relay log fails to rotate, slave will crash after
The relay log may not be open for some reason (e.g. disk error) after rotation,
and using it causes the slave crash.

Fix: check we have it open before access, return error otherwise.
2006-12-18 17:38:59 +04:00
rafal@quant.(none)
c336960463 BUG#21132 (Slave fails to reconnect on update_slave_list):
The update_slave_list() call is a remainder from attempts to implement failsafe 
replication. This code is now obsolete and not maintained (see comments in 
rpl_failsafe.cc). 

Inspecting the code one can see that this function do not interferre with normal 
slave operation and thus can be safely removed. This will solve the issue 
reported in the bug (errors on slave reconnection). 

A related issue is to remove unneccessary reconnections done by slave. This is 
handled in the patch for BUG#20435.
2006-12-15 11:32:41 +01:00
monty@mysql.com/narttu.mysql.fi
9d3fda77c8 After merge fixes:
- Remove compiler warnings
- Fix merge errors
- Indentation fixes
2006-12-15 06:21:15 +02:00
monty@mysql.com/narttu.mysql.fi
88dd873de0 Fixed compiler warnings detected by option -Wshadow and -Wunused:
- Removed not used variables and functions
- Added #ifdef around code that is not used
- Renamed variables and functions to avoid conflicts
- Removed some not used arguments

Fixed some class/struct warnings in ndb
Added define IS_LONGDATA() to simplify code in libmysql.c

I did run gcov on the changes and added 'purecov' comments on almost all lines that was not just variable name changes
2006-12-15 00:51:37 +02:00
monty@mysql.com/narttu.mysql.fi
3d40956039 Fixed portability issue in my_thr_init.c (was added in my last push)
Fixed compiler warnings (detected by VC++):
- Removed not used variables
- Added casts
- Fixed wrong assignments to bool
- Fixed wrong calls with bool arguments
- Added missing argument to store(longlong), which caused wrong store method to be called.
2006-11-30 18:25:05 +02:00
monty@mysql.com/nosik.monty.fi
306b871d52 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/my/mysql-5.0
2006-11-20 22:46:52 +02:00
monty@mysql.com/nosik.monty.fi
e825879800 Remove compiler warnings
(Mostly in DBUG_PRINT() and unused arguments)
Fixed bug in query cache when used with traceing (--with-debug)
Fixed memory leak in mysqldump
Removed warnings from mysqltest scripts (replaced -- with #)
2006-11-20 22:42:06 +02:00
lars@mysql.com/black.(none)
7aa562ad20 Merge mysql.com:/home/bk/MERGE/mysql-4.1-merge
into  mysql.com:/home/bk/MERGE/mysql-5.0-merge
2006-11-13 17:54:01 +01:00
lars@mysql.com/black.(none)
c5d56416ba Merge mysql.com:/home/bkroot/mysql-5.0-rpl
into  mysql.com:/home/bk/MERGE/mysql-5.0-merge
2006-11-13 12:44:53 +01:00