Commit graph

162 commits

Author SHA1 Message Date
gbichot@quadxeon.mysql.com
d823bee92a safer creation of temp files used in replication of LOAD DATA INFILE.
When we come to create these, they may already exist and it's necessary to delete these old, useless copies.
2005-03-17 14:39:39 +01:00
guilhem@mysql.com
7743dbbb56 When mysqlbinlog prints LOAD DATA INFILE, let it print the thread id. Some customer would have benefited
much from this in his recovery. All this change does is adding one commented (#) line before the LOAD DATA
command, so it is quite innocuous.
2004-11-18 22:59:17 +01:00
guilhem@mysql.com
168e4c9c6b when we update thd->db in replication, it's safer to update thd->db_length too.
This does not fix any known bug, but is still a good idea.
2004-09-07 14:57:54 +02:00
guilhem@mysql.com
93101561fd Fix for BUG#4500 "set character set replicates incorrectly"
We must not reset the charset in slave after each statement, otherwise the SET CHARACTER SET is cancelled immediately.
Instead, we write a SET CHARACTER SET DEFAULT to the master's binlog when needed (like we already do for SET FOREIGN_KEY_CHECKS);
such writing is not necessary in 4.1 (in 4.1 the bug does not exist, as the SET ONE_SHOT syntax is used).
I have written a test and it works, but I'm not pushing the test as it requires building with all charsets.
I have noticed differences between what is inserted in the master's table in 4.0 and 4.1, and alerted Bar.
2004-08-29 14:13:51 +02:00
guilhem@mysql.com
74809f7445 Fix for BUG#4326 "Replicated LOAD DATA INFILE show nothing in
processlist on slave":
we now report in SHOW PROCESSLIST that we are writing to the temp
files or loading the table. When we are writing to the tmp file:
| 3  | system user |                 |    | Connect | 6    | Making temp file /tmp/SQL_LOAD-2-1-2.data | 
and when we are actually loading the .data temp file into the table:
| 3  | system user |                 | test | Connect | 2    | | LOAD DATA INFILE '/tmp/SQL_LOAD-2-1-2.data' INTO TABLE `t` <...> |
2004-06-30 15:41:35 +02:00
hf@deer.(none)
78f58ff384 Fix to make Windows compilation smoother 2004-05-26 21:40:27 +05:00
heikki@hundin.mysql.fi
02f51ccf2d Many files:
Fix remaining cases of Bug #3596: fix possible races caused by an obsolete value of thd->query_length in SHOW PROCESSLIST and SHOW INNODB STATUS; this fix depends on the fact that thd->query is always set to NULL before setting it to point to a new query
2004-05-14 16:48:56 +03:00
guilhem@mysql.com
a5aeb8f7fa Fix for Bug#3357 "If the statement is long, the error message is trunc and important info is lost";
in hard-coded replication messages, always put small-length info (error codes, explanation of the error) at the beginning,
so that it is not cut by truncation if the query is very long (which happens if the query goes first).
2004-05-04 15:48:40 +02:00
guilhem@mysql.com
58e90107d9 Fix for BUG#3415 "mysqlbinlog loses a USE command when LOAD DATA INFILE is involved":
if you are printing LOAD DATA INFILE and its USE as comments, don't update 'last_db' (because you
have not actually changed the db in the server).
2004-04-07 18:34:31 +02:00
guilhem@mysql.com
b5ffdec204 This is a fix for a bug in 3.23 -> 4.0 replication: Exec_master_log_pos is always
too big by 6 bytes. So I add code to substract 6 bytes if the master is 3.23.
This is not perfect (because it won't work if the slave I/O thread has not
noticed yet that the master is 3.23), but as long as the slave I/O thread
starts Exec_master_log_pos will be ok.
It must be merged to 4.1 but not to 5.0 (or it can be, because of #if MYSQL_VERSION_ID),
because 5.0 already works if the master is 3.23 (and in a more natural way:
in 5.0 we store the end_log_pos in the binlog and relay log).
I had to move functions from slave.h to slave.cc to satisfy gcc.
2004-04-07 00:57:14 +02:00
guilhem@mysql.com
69517b22a1 Fix for BUG#2983 "If statement was killed on master, slave errors despite replicate-wild-ignore-t"
We introduce a new function mysql_test_parse_for_slave().
If the slave sees that the query got a really bad error on master
(killed e.g.), then it calls this function to know if this query
can be ignored because of replicate-*-table rules (do not worry
about replicate-*-db rules: they are checked so early that they have
no bug). If the answer is yes, it skips the query and continues. If
it's no, then it stops and say "fix your slave data manually" (like it
did before this change).
2004-03-11 17:38:19 +01:00
guilhem@mysql.com
30541b324c Undoing 2 parts of changeset 1.1730.1.1 :
- the one about BUG#2921
- the one about relay log flushing
Both will be rewritten in a next changeset
(this one will not be pushed before the next changeset).
2004-03-10 16:30:47 +01:00
monty@mysql.com
7738d08294 Merge bk-internal.mysql.com:/home/bk/mysql-4.0
into mysql.com:/home/my/mysql-4.0
2004-03-10 13:48:41 +02:00
monty@mysql.com
4ee44751d9 Fixed memory leak in DROP DATABASE when using RAID tables (Bug #2882) 2004-03-10 13:46:11 +02:00
guilhem@mysql.com
2c31370a30 Fix for BUG#3081 "if an INSERT DELAYED is killed, it is binlogged as killed but it's not needed".
INSERT DELAYED works only for one-row inserts (in latest 4.0 versions
at least). So killing a delayed_insert thread does not spoil replication:
the rows which actually went into the table are exactly those listed
in the binlog. So when the delayed_insert thread is killed, don't log
it as 'killed', because it causes superfluous stops on the slave.
2004-03-08 14:47:13 +01:00
guilhem@mysql.com
bce65d4b76 Fix for BUG#3015
"(binlog, position) stored by InnoDB for a replication slave can be wrong".
This code contains conditional #if to distinguish between versions;
it should be merged into 4.1 and 5.0.
2004-03-01 15:15:58 +01:00
guilhem@mysql.com
e022ba6063 Fix for BUG#3017
"wrong Relay_Log_Pos if Rotate is in the middle of a transaction in relay log"
increment 'pending' instead of 'relay_log_pos'.
2004-03-01 00:46:31 +01:00
Greg@greg-laptop.
f4ebcaff4d Changes to fix errors encountered in test builds on Windows. 2004-02-27 16:51:01 +01:00
monty@mysql.com
fb8f27f017 Always use libtool with "--preserve-dup-deps"
Always use all LOAD DATA options in replication.
Fixed problem in mysqlbinlog where LOAD DATA options could be overwritten.
2004-02-13 16:05:09 +02:00
vva@eagle.mysql.r18.ru
0333f7b10f fixed bug #1378 "mysqlbinlog for remote host is broken" 2004-02-06 20:57:11 +04:00
guilhem@mysql.com
1067e197aa Fix for BUG#2542 "If slave ignores a query it may make the next LOAD DATA INFILE fail":
reset errors (in thd) before executing the event. Otherwise if an event is ignored
because of replicate-*-table rules (error ER_SLAVE_IGNORED_TABLE) this error code
may remain in thd->net and the next event may pick it.
2004-01-28 15:26:01 +01:00
guilhem@mysql.com
db2d812d1b Fix for BUG#2083
"EE_ error codes (EE_DELETE, EE_WRITE) end up in the binlog, making slave stop".
The problem was that during execution of the command on the master, an error
can occur (for example, not space left on device, then mysqld waits and when
there is space it completes successfully: so finally it worked but the error
EE_WRITE remains in thd->net.last_errno and thd->net.last_error).
To know if finally the command succeeded, we test the 'error' variable in
every place, and if it shows no failure we reset thd->net.last_err* using
the function THD::clear_error() which is backported from 4.1.
A new test to see if now only real errors get to the binlog (note: the test
uses "rm").

Also a bit of memory free/alloc saving in log_event.cc (do not free the whole
mem_root after every query in the slave SQL thread: we can keep the initial
block of it; which will be freed when the thread terminates).
2003-12-16 11:10:50 +01:00
guilhem@mysql.com
dba12258b9 Fix for BUG#2045 "Sending SIGHUP to mysqld crashes it if running with --log-bin".
The constructor of Rotate_log_event used when we are rotating our binlog or
relay log, should not assume that there is a nonzero THD available.
For example, when we are reacting to SIGHUP, the THD is 0.
In fact we don't need to use the THD in this constructor;
we can do like for Stop_log_event, and use the minimal Log_event
constructor.
If we were allowed to put Unix-specific commands in the testsuite,
I'd add a test for this (<sigh>).
2003-12-08 16:18:25 +01:00
guilhem@mysql.com
c1f7f33960 4 small items in this:
- when we don't have in_addr_t, use uint32.
- a forgotten initialization of slave_proxy_id in sql/log_event.cc (was not really "forgot", was
"we needn't init it there", but there was one case where we needed...).
- made slave_proxy_id always meaningful in THD and Log_event, so we can
rely more on it (no need to test if it's meaningful). THD::slave_proxy_id
is equal to THD::thread_id except for the slave SQL thread.
- clean up the slave's temporary table (i.e. free their memory) when slave
server shuts down.
2003-10-31 23:20:23 +01:00
konstantin@mysql.com
f9015d5ac8 thd->query assignment moved out
of lock scope
2003-10-31 17:03:08 +03:00
guilhem@mysql.com
59d0872aa0 Fix for BUG#1686
"If 2 master threads with same-name temp table, slave makes bad binlog"
and (two birds with one stone) for
BUG#1240 "slave of slave breaks when STOP SLAVE was issud on parent slave
and temp tables".

Here is the design change:
in a slave running with --log-slave-updates, events are now logged with the
thread id they had on the master. So no more id conflicts between master threads,
but introduces id conflicts between one master thread and one normal 
client thread connected to the slave. This is solved by storing the server id
in the temp table's name.

New test which requires mysql-test-run to be run with --manager,
otherwise it will be skipped.

Undoing a Monty's change (hum, a chill runs down my spine ;) which was
"Cleanup temporary tables when slave ends" in ChangeSet 1.1572.1.1.
2003-10-29 14:23:35 +01:00
monty@mashka.mysql.fi
c95d142f8f Add new user variables for tuning memory usage:
query_alloc_block_size, query_prealloc_size, range_alloc_block_size,transaction_alloc_block_size and transaction_prealloc_size
Add more checks for "out of memory" detection in range optimization
2003-10-11 22:00:24 +03:00
monty@narttu.mysql.fi
446d40e880 After merge fixes 2003-10-07 00:23:29 +03:00
guilhem@mysql.com
52ae1609eb When the I/O thread was stopped while copying a long transaction, and restarted,
Rotate_log_event::exec_event() believed that the relay log was corrupted. Fixed it
by moving the test for corruption to Start_log_event::exec_event(). 
Changed Rotate_log_event::exec_event() to not increment positions when the
event is seen in the middle of a transaction.
I did a separate commit in 4.1 (so this should not be merged to 4.0) because
code is a bit different in 4.1.
A test to see if the slave detects when the master died while writing a 
transaction to the binlog (uses a forged truncated binlog I made).
2003-10-03 22:13:01 +02:00
monty@narttu.mysql.fi
89f30200bc Removed random chars after filename for LOAD DATA INFILE (in mysqlbinlog)
Add quoting for use `database` for mysqlbinlog
Removed test ins0000001
Add support for --replace for exec in mysqltest
Don't refer to install dir in mysqlbinlog.result
2003-09-29 12:31:35 +03:00
dlenev@mysql.com
7795de8906 Merge bk-internal.mysql.com:/home/bk/mysql-4.0
into mysql.com:/home/dlenev/src/mysql-4.0-bgrn
2003-09-25 01:25:54 +04:00
dlenev@mysql.com
7826fce264 Fixed BUG#1357 MySQL too eagerly cleanups temporary files for LOAD DATA (SQL_LOAD-...) 2003-09-25 01:25:19 +04:00
guilhem@mysql.com
b4171fe620 Fix for
Bug #1392 "On Win, slave leaves one temp file after successf. replicating LOAD DATA INFILE"
Windows-specific bug (we forgot to close a file before deleting it).
Patch written by me, tested by Miguel (thanks!) and it works.
2003-09-24 22:55:04 +02:00
monty@narttu.mysql.fi
a2a1e97226 Portability fixes 2003-08-28 22:18:02 +03:00
monty@narttu.mysql.fi
f5a134ba56 Merge bk-internal.mysql.com:/home/bk/mysql-4.0
into narttu.mysql.fi:/my/mysql-4.0
2003-08-25 17:20:51 +03:00
monty@narttu.mysql.fi
f83e876065 Update of VC++ project files (to remove link warnings)
Fix unlock error in myisamchk on windows when doing --sort-index
Use SetFilePointer instead of SetFilePointerEx
2003-08-25 14:27:32 +03:00
guilhem@mysql.com
10811aba88 * Fix for a potential bug:
when the SQL thread stops, set rli->inside_transaction to 0. This is needed if the user
later restarts replication from a completely different place where there are only autocommit
statements.
* Detect the case where the master died while flushing the binlog cache to the binlog
and stop with error. Cannot add a testcase for this in 4.0 (I tested it manually)
as the slave always runs with --skip-innodb.
2003-08-23 16:53:04 +02:00
guilhem@mysql.com
759a3c1e3c 2 minor edits, plus
fix for BUG#1113 "INSERT into non-trans table SELECT ; ROLLBACK" does not send warning"
and
fix for BUG#873 "In transaction, INSERT to non-trans table is written too early to binlog".
Now we don't always write the non-trans update immediately to the binlog;
if there is something in the binlog cache we write it to the binlog cache
(because the non-trans update could depend on a trans table which was modified
earlier in the transaction); then in case of ROLLBACK, we write the binlog
cache to the binlog, wrapped with BEGIN/ROLLBACK.
This guarantees that the slave does the same updates.
For ROLLBACK TO SAVEPOINT: when we execute a SAVEPOINT command we write it
to the binlog cache. At ROLLBACK TO SAVEPOINT, if some non-trans table was updated,
we write ROLLBACK TO SAVEPOINT to the binlog cache; when the transaction
terminates (COMMIT/ROLLBACK), the binlog cache will be flushed to the binlog
(because of the non-trans update) so we'll have SAVEPOINT and ROLLBACK TO
SAVEPOINT in the binlog.

Apart from this rare case of updates of mixed table types in transaction, the
usual way is still clear the binlog cache at ROLLBACK, or chop it at
ROLLBACK TO SAVEPOINT (meaning the SAVEPOINT command is also chopped, which
is fine).
Note that BUG#873 encompasses subbugs 1) and 2) of BUG#333 "3 binlogging bugs when doing INSERT with mixed InnoDB/MyISAM".
2003-08-22 15:39:24 +02:00
guilhem@mysql.com
f405287beb Merge gbichot@bk-internal.mysql.com:/home/bk/mysql-4.0
into mysql.com:/home/mysql_src/mysql-4.0
2003-08-20 23:25:58 +02:00
guilhem@mysql.com
1dd53ed073 First commit for fixing BUG#1100
"LOAD DATA INFILE is badly filtered by binlog-*-db rules".
There will probably be a second final one to merge Dmitri's changes
to rpl_log.result and mine.
2 new tests:
rpl_loaddata_rule_m : test of logging of LOAD DATA INFILE when the master has binlog-*-db rules,
rpl_loaddata_rule_s : test of logging of LOAD DATA INFILE when the slave has binlog-*-db rules and --log-slave-updates.
2003-08-20 23:24:45 +02:00
dlenev@mysql.com
bb96092202 Fix for BUG#1086. Now we don't preserve event's log_pos through
log-slave-updates since this causes unexpected values in 
Exec_master_log_pos in A->B->C replication setup, synchronization
 problems in master_pos_wait()... 
Still this brokes some functionality in sql/repl_failsafe.cc 
(but this file is not used now)
2003-08-20 03:38:31 +04:00
guilhem@mysql.com
6e32e19047 Use my_b_append instead of my_b_write on a SEQ_READ_APPEND cache, when we write
the first 4 bytes of the relay log. Indeed comments in mysys/mf_iocache.c 
say we must always use my_b_append for such a cache.
This *could* avoid a very rare assertion failure which is: 
030524 19:32:38  Slave SQL thread initialized, starting replication in log 'FIRST' at position 0, relay log '/
users/gbichot/4.1.1/mysql-test/var/log/slave-relay-bin.000001' position: 4
030524 19:32:38  next log '/users/gbichot/4.1.1/mysql-test/var/log/slave-relay-bin.000002' is currently active
mysqld: mf_iocache.c:701: _my_b_seq_read: Assertion `pos_in_file == info->end_of_file' failed.
and which seemed to happen always when the SQL thread and/or the I/O thread
were at position 4 in a relay log.
2003-08-19 17:00:36 +02:00
guilhem@mysql.com
1a5c8be408 Fix for BUG#1096 which is:
"mysqlbinlog does not comment the original LOAD DATA INFILE if it has a "use xx""
2003-08-19 15:46:47 +02:00
monty@mashka.mysql.fi
2fb441fdf7 Remove wrong bug fix when calling create_sort_index.
Fix possible replication bug with LOAD DATA ... IGNORE LINES #
2003-08-10 05:14:16 +03:00
monty@mashka.mysql.fi
8f08c511ee Review of changesets since last pull.
(Mostly code cleanups)
2003-08-07 20:16:37 +03:00
guilhem@mysql.com
df3b31f3c4 WL#1036 (print the db in slave error messages).
I extended the task to cleaning error messages, making them look nicer,
and making the output of SHOW SLAVE STATUS (column Last_error) be as complete
as what's printed on the .err file;
previously we would have, for a failure of a replicated LOAD DATA INFILE:
- in the .err, 2 lines:
"duplicate entry 2708 for key 1"
"failed loading SQL_LOAD-5-2-2.info"
- and in SHOW SLAVE STATUS, only:
"failed loading SQL_LOAD-5-2-2.info".
Now SHOW SLAVE STATUS will contain the concatenation of the 2 messages.
2003-07-24 22:25:36 +02:00
monty@mashka.mysql.fi
e1aa90a9bf Safety and speedup fixes:
Changed is_open() to work as before.
Added back inited argument to LOG
2003-07-14 10:12:05 +03:00
guilhem@mysql.com
fbebac9a48 Fix for BUG#791:
a safer way of initing the mutexes in MYSQL_LOG.
is_open() is now always thread-safe.
See each file for details.
2003-07-11 14:26:44 +02:00
guilhem@mysql.com
46b0e778b8 Fix for
BUG#797 "If query ignored on slave (replicate-ignore-table) the slave still checks if
the returned error (0) is the same as the one on the master, whereas it shouldn't
test this.
Plus a new test for BUG#797.
2003-07-08 15:50:57 +02:00
vva@eagle.mysql.r18.ru
c96c87d51d fixed bug #670 2003-07-04 16:06:17 -04:00