Commit graph

583 commits

Author SHA1 Message Date
lars@mysql.com
efb077502d Merge 2005-03-21 23:05:55 +01:00
lars@mysql.com
c6d85289ab WL#2472:
Renamed Table_filter to Rpl_filter
Eliminated very annoying memory leak
2005-03-21 22:09:42 +01:00
lars@mysql.com
7ed7fc7f58 WL#2472: Addendum: Fixes after Mats review 2005-03-10 14:36:48 +01:00
serg@serg.mylan
c49928447d Merge bk-internal:/home/bk/mysql-5.0
into serg.mylan:/usr/home/serg/Abk/mysql-5.0
2005-03-09 13:02:51 +01:00
serg@serg.mylan
1e09c15a8b don't close binlog in the destructor - use explictit MYSQL_LOG::cleanup for this 2005-03-09 12:29:51 +01:00
lars@mysql.com
26787260b7 WL#2472: Refactoring of replication and binlog filtering.
Needed to be able to have multiple masters connected 
to same slave server with different filters.
2005-03-08 21:12:35 +01:00
guilhem@mysql.com
c4ac232d17 First part of fix for BUG#7998 "Replication should be more clever about when to replicate RELEASE_LOCK()"
(next part is updating test results)
2005-03-02 16:37:54 +01:00
guilhem@mysql.com
c6cedf52e3 Merge 2005-03-02 14:46:19 +01:00
guilhem@mysql.com
11a1c83c03 Fix for BUG#8325 "Deadlock in replication thread stops replication":
in slave SQL thread: if a transaction fails because of InnoDB deadlock or innodb_lock_wait_timeout exceeded,
optionally retry the transaction a certain number of times (new variable --slave_transaction_retries).
2005-03-02 11:29:48 +01:00
monty@mysql.com
0a6b7aedb2 Remove compiler warnings and remove not used variables
(Found during build process)
2005-02-25 16:53:22 +02:00
serg@serg.mylan
2b41b8fa01 post-review fixes. Now ROLLBACK is done in Format_description_log_event 2005-02-17 13:52:16 +01:00
serg@serg.mylan
fd828e5b4d manually merged 2005-02-14 21:50:09 +01:00
serg@serg.mylan
db13afd89d auto-ROLLBACK if binlog was not closed properly
auto-commit on Xid_log_event
2005-02-09 20:04:28 +01:00
acurtis@pcgem.rdg.cyberkinetica.com
0b1f98e83e Ensure that slaves have normal COMMIT behaviour after WL#1967 2005-02-07 13:15:48 +00:00
guilhem@mysql.com
ed1696f6b9 WL#1062 "log charset info into all Query_log_event":
we store 7 bytes (1 + 2*3) in every Query_log_event.
In the future if users want binlog optimized for small size and less safe,
we could add --binlog-no-charset (and binlog-no-sql-mode etc): charset info
is something by design optional (even if for now we don't offer possibility to disable it):
it's not a binlog format change.
We try to reduce the number of get_charset() calls in the slave SQL thread to a minimum
by caching the charset read from the previous event (which will often be equal to the one of the current event).
We don't use SET ONE_SHOT for charset-aware repl (we still do for timezones, will be fixed later).
No more errors if one changes the global value of charset vars on master or slave
(as we log charset info in all Query_log_event).
Not fixing Load_log_event as it will be rewritten soon by Dmitri.
Testing how mysqlbinlog behaves in rpl_charset.test.
mysqlbinlog needs to know where charset file is (to be able to convert a charset number found
in binlog (e.g. in User_var_log_event) to a charset name); mysql-test-run needs to pass
the correct value for this option to mysqlbinlog.
Many result udpates (adding charset info into every event shifts log_pos in SHOW BINLOG EVENTS).
Roughly the same job is to be done for timezones :)
2005-02-03 16:22:16 +01:00
serg@serg.mylan
fb78bfebe4 open binlog index file *before* tc_log->open() and binlog itself *after* 2005-02-01 15:36:48 +01:00
serg@serg.mylan
c76405a7ee merged 2005-01-24 19:41:42 +01:00
serg@serg.mylan
79240013b2 Merge serg@bk-internal.mysql.com:/home/bk/mysql-4.1/
into serg.mylan:/usr/home/serg/Abk/mysql-4.1
2005-01-24 15:50:13 +01:00
serg@serg.mylan
67ba2e367a fixes/cleanups according to Coverity report 2005-01-24 15:48:25 +01:00
guilhem@mysql.com
78b7ec0258 slave.cc:
5.0 has a different way of knowing if master is < 3.23.57
2005-01-18 14:46:26 +01:00
guilhem@mysql.com
5fbdd9bdcd Merge mysql.com:/home/mysql_src/mysql-4.1-clean
into mysql.com:/home/mysql_src/mysql-5.0-clean
2005-01-18 11:06:37 +01:00
guilhem@mysql.com
5e43cf86a6 Fix for BUG#7965 "Slave_IO_State Stuck at 'Checking Master Version'":
Working around hang of master < 3.23.50 on SELECT @@unknown_var
(to enable 3.23.49->4.1.10 replication)
2005-01-17 21:26:14 +01:00
monty@mysql.com
d35140a851 First stage of table definition cache
Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon)
Created Field::make_field() and made Field_num::make_field() to call this
Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead
Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer.
Renamed TABLE_SHARE->real_name to table_name
Renamed TABLE->table_name to alias
Renamed TABLE_LIST->real_name to table_name
2005-01-06 13:00:13 +02:00
monty@mishka.local
4f4bbfc279 Merge with 4.1 2004-12-22 13:54:39 +02:00
guilhem@mysql.com
3287e82f09 Very minor fixes for Seconds_Behind_Master column of SHOW SLAVE STATUS. 2004-12-16 22:38:42 +01:00
guilhem@mysql.com
ea99ce4e09 A change of behaviour of Seconds_Behind_Master from SHOW SLAVE STATUS. It's going into 4.1
because old behaviour was somewhat nonsensical (kind of bug). Changes are that if repl threads are
down or disconnected the column will be NULL, and if master is idle the column will not grow indefinitely anymore.
2004-12-16 18:12:22 +01:00
guilhem@mysql.com
1cbc904c59 Changing the default of libmysqlclient : it's now NO reconnection.
All our programs which use mysql_real_connect() and mysql_connect() are updated accordingly, though I have deliberately
made mysqlimport not reconnect anymore (already true for mysqldump >= 4.1.8).
All Connector devs have been warned about the change I'm doing here - which was agreed with Monty,
and fixes BUG#2555.
2004-12-09 14:44:10 +01:00
monty@mysql.com
0de4777187 Merge with 4.1 2004-12-06 11:38:56 +02:00
lars@mysql.com
f900433bbe Due to a compiler bug, slave.cc:tables_ok() sometimes wrongly returns
1 if the return type is int or int_fast8_t.  The test case that showed
this problem is rpl000001 and the tested version was MySQL 5.0.2.  The
compiler with the problem is GCC 3.0.4 runing on "Linux bitch 2.4.18
#2 Thu Apr 11 14:37:17 EDT 2002 sparc64 unknown".

By changing the return type to bool the problem disappear.  (Another
way to make the problem disappear is to simply print the returned
value with printf("%d",?).  The printed returned value is always 0 in
the test cases I have run.)  This is only a partial solution to the
problem, since someone could later change the return type of the
function back to int or some other type that does not work.
2004-12-03 15:18:25 +01:00
serg@serg.mylan
b460059988 merged 2004-11-28 20:42:04 +01:00
serg@serg.mylan
96729c62be merged 2004-11-28 18:19:01 +01:00
tomas@poseidon.ndb.mysql.com
97c8234b46 Merge tulin@bk-internal.mysql.com:/home/bk/mysql-4.1
into poseidon.ndb.mysql.com:/home/tomas/mysql-5.0
2004-11-26 13:44:49 +00:00
monty@mysql.com
eb304bd49f Fixes while reviewing code
(Cleanups and better bug fixes)
2004-11-26 02:31:22 +02:00
mats@mysql.com
9ffb3fd39c Merge 2004-11-25 12:23:41 +01:00
mats@mysql.com
c06cae0f55 Fix for Bug#6148. Only rewind read position in binary log when the
slave SQL thread is started.
2004-11-25 09:26:45 +01:00
serg@serg.mylan
e68bd85b77 merged 2004-11-17 18:04:36 +01:00
guilhem@mysql.com
d34421c127 Fixes for compilation errors in Windows (casts from uint32* to uint*) in repl and charset code.
Moving the part of user_var.test using UCS2 to ctype_ucs.test
2004-11-17 16:41:30 +01:00
bell@sanja.is.com.ua
7210195f1e now my_printf_error is not better then my_error, but my_error call is shorter
used only one implementation of format parser of (printf)
fixed multistatement
2004-11-13 19:35:51 +02:00
bell@sanja.is.com.ua
1555469b64 merge 2004-11-12 15:36:31 +02:00
bell@sanja.is.com.ua
31f7811183 post-review fixes 2004-11-12 14:34:00 +02:00
brian@avenger.(none)
f05daf02ba Resolved merge from 4.1 -> 5.0 (mainly Guilhem's work with mysqldump) 2004-11-11 18:58:57 -08:00
monty@mysql.com
7d78fd077a Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/my/mysql-4.1
2004-11-11 00:36:56 +02:00
monty@mysql.com
c7e85ef9b9 More debugging
Print position in normal log for Binlog dump
2004-11-10 18:07:39 +02:00
monty@mysql.com
afbe601302 merge with 4.1 2004-10-29 19:26:52 +03:00
bell@sanja.is.com.ua
4714a6e744 errors without code removed
net_printf/send_error calls replaced by my_error family functions
-1/1 (sent/unsent) error reporting removed
(WL#2133)
2004-10-20 04:04:37 +03:00
guilhem@mysql.com
41b808d224 Optimization: in the replication slave, we can avoid doing one strlen() per event's execution,
as we already have db_len in Log_event. Only if rewrite_db() changed the db we need a strlen
(so we now do the strlen() in rewrite_db). Plus a test (we had none for --replicate-rewrite-db :( ).
2004-10-19 22:27:19 +02:00
monty@mishka.local
91ff64e107 Added options --auto-increment-increment and --auto-increment-offset.
This allows one to setup a master <-> master replication with non conflicting auto-increment series.
Cleaned up binary log code to make it easyer to add new state variables.
Added simpler 'upper level' logic for artificial events (events that should not cause cleanups on slave).
Simplified binary log handling.
Changed how auto_increment works together with to SET INSERT_ID=# to make it more predictable: Now the inserted rows in a multi-row statement are set independent of the existing rows in the table. (Before only InnoDB did this correctly)
2004-09-15 22:10:31 +03:00
serg@serg.mylan
9a1456b45a few s/sql_print_error/sql_print_information/ 2004-09-08 10:45:50 +02:00
serg@serg.mylan
323e683cbf merged 2004-09-07 21:30:28 +02: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
monty@mysql.com
31122efde7 Merge with 4.1
(Includes merge of arena code in 4.1 and 5.0)
2004-09-06 15:14:10 +03:00
serg@serg.mylan
62c2f1c161 sql_print_error cleanup 2004-09-04 20:17:09 +02:00
rburnett@build.mysql.com
680aa3d69d Bug #4629 Crash after SLAVE STOP, if the IO thread is in special state.
client.c:
  Removed call to clear_slave_vio in end_server().  Removed header declaration of clear_slave_vio
slave.cc:
  Removed clear_slave_vio function and added calls to thd->clear_active_vio before each call to end_server()
2004-08-23 18:55:12 +02:00
rburnett@build.mysql.com
3bd71971d6 Bug #4629 Crash after SLAVE STOP, if the IO thread is in special state.
client.c:
  Added call to clear_slave_vio inside end_server only when under Windows with repliaction
slave.cc:
  Added clear_slave_vio function for clearing active vio on THD under Windows replication
2004-08-21 05:07:32 +02:00
serg@serg.mylan
e1237cbc53 manually merged 2004-08-18 19:57:55 +02:00
guilhem@mysql.com
6345dc4fbd Fix for BUG#4678 "mysql-test-run fails on grant_cache":
do not use '' as user in tests, because it picks the Unix login (which gives unexpected results if it is 'root')
(such behaviour is a feature of mysql_real_connect(), see the manual).
2004-08-12 13:12:09 +02:00
konstantin@mysql.com
d3e520ce7e Port of cursors to be pushed into 5.0 tree:
- client side part is simple and may be considered stable
- server side part now just joggles with THD state to save execution
  state and has no additional locking wisdom.
  Lot's of it are to be rewritten.
2004-08-03 03:32:21 -07:00
guilhem@mysql.com
dd023bc878 Fix for:
Bug #4810 "deadlock with KILL when the victim was in a wait state"
(I included mutex unlock into exit_cond() for future safety)
and BUG#4827 "KILL while START SLAVE may lead to replication slave crash"
2004-07-31 22:33:20 +02:00
guilhem@mysql.com
31f61883df Replication: various small fixes specific to the new binlog format of 5.0
(including one which may explain autobuild's failure of yesterday)
2004-07-26 19:42:59 +02:00
bell@sanja.is.com.ua
9336d36cf8 VIEW
two TABLE_LIST copy eliminated
2004-07-16 01:15:55 +03:00
monty@mysql.com
1e31199995 Merge with 4.1.3-beta 2004-07-07 11:29:39 +03:00
konstantin@mysql.com
b793142c8f Unused variables removed (many files). 2004-06-21 20:39:19 +04:00
dlenev@brandersnatch.localdomain
09ba29e539 WL#1264 "Per-thread time zone support infrastructure".
Added basic per-thread time zone functionality (based on public
domain elsie-code). Now user can select current time zone
(from the list of time zones described in system tables).
All NOW-like functions honor this time zone, values of TIMESTAMP
type are interpreted as values in this time zone, so now
our TIMESTAMP type behaves similar to Oracle's TIMESTAMP WITH
LOCAL TIME ZONE (or proper PostgresSQL type).
  
WL#1266 "CONVERT_TZ() - basic time with time zone conversion 
function".
  
Fixed problems described in Bug #2336 (Different number of warnings 
when inserting bad datetime as string or as number). This required
reworking of datetime realted warning hadling (they now generated 
at Field object level not in conversion functions).
  
Optimization: Now Field class descendants use table->in_use member
instead of current_thd macro.
2004-06-18 10:11:31 +04:00
guilhem@mysql.com
10429acb8e don't need to tag the slave SQL thread as "bootstrap". It causes duplicate
error messages when a query goes wrong.
Note that from now on, if you run with --slave-skip-error=xx, then nothing will
be printed to the error log when the slave is having this error xx and
skipping it (but you don't care as you want to skip it).
2004-06-10 14:03:25 +02:00
guilhem@mysql.com
da835a0a06 Merge gbichot@213.136.52.20:/home/bk/mysql-4.1
into mysql.com:/home/mysql_src/mysql-4.1
2004-06-03 23:19:01 +02:00
guilhem@mysql.com
86e8ecc965 Implementation of WL#1824 "Add replication of character set variables in 4.1",
by binlogging some SET ONE_SHOT CHARACTER_SETetc,
which will be enough until we have it more compact and more complete in 5.0. With the present patch,
replication will work ok between 4.1.3 master and slaves, as long as:
- master and slave have the same GLOBAL.COLLATION_SERVER
- COLLATION_DATABASE and CHARACTER_SET_DATABASE are not used
- application does not use the fact that table is created with charset of the USEd db (BUG#2326).
all of which are not too hard to fulfill. 
ONE_SHOT is reserved for internal use of mysqlbinlog|mysql and works only for charsets,
so we give error if used for non-charset vars.
Fix for BUG#3875 "mysqlbinlog produces wrong ouput  if query uses
 variables containing quotes" and BUG#3943 "Queries with non-ASCII literals are not replicated
 properly after SET NAMES".
Detecting that master and slave have different global charsets or server ids.
2004-06-03 23:17:18 +02:00
hf@deer.(none)
38334f62a4 Proposed fix for bug #3412 (embedded server: prepared statement returns
empty recordset where some records should be found)
2004-05-28 15:59:29 +05:00
pem@mysql.com
71eddc362e Merging 4.1 to 5.0. 2004-05-26 17:04:45 +02:00
monty@mysql.com
af44187bff Merge with 4.0 to get fixes for Windows project files 2004-05-25 02:47:25 +03:00
guilhem@mysql.com
50a2d97102 Fix for BUG#3871: a slave must always replicate a statement, even if it examines more than 4G rows,
so we set SQL_BIG_SELECTS to 1.
2004-05-24 18:46:49 +02:00
monty@mysql.com
a4b0ec1ede Merge with 4.0, mainly to get changes to windows project files 2004-05-20 00:54:52 +03:00
guilhem@mysql.com
319f83ef9b Fix for BUG#3829 "Setting server_id on fly doesn't allow replication to start"
(fix by our Harrison Fisk): when one does SET GLOBAL SERVER_ID=x, we must set
server_id_supplied to 1.
2004-05-19 15:03:32 +02:00
monty@mysql.com
cd3dab49cc Merge with 4.0.20 2004-05-17 01:52:13 +03:00
guilhem@mysql.com
9620715679 a code fix (don't specify default value of argument twice), updating a line of SHOW SLAVE STATUS
in tests after the last 4.1->5.0 merge, and:
*** The same as ChangeSet@1.1822.1.1, 2004-05-14 23:08:03+02:00, guilhem@mysql.com of MySQL 4.0 ***
  Replication testsuite: making the master-slave synchronization less likely to fail,
  by adding sleep-and-retries (max 4 times) if MASTER_POS_WAIT() returns NULL
  in sync_with_master and sync_slave_with_master.
  The problem showed up only today, in MySQL 5.0 in rpl_server_id2.test,
  but may affect 4.x as well, so I fixed 4.x too. Note that I am also fixing
  5.0, with the same exact patch, because I don't want to leave 5.0 broken
  until the next 4.0->4.1->5.0 merge.
2004-05-14 23:19:42 +02:00
pem@mysql.comhem.se
ec92106535 Post-merge fixes.
Note: One sp.test still fails (prime), and rpl_server_id2.test fails (will be fixed by guilhem ASAP).
2004-05-14 16:00:57 +02: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
pem@mysql.com
bf45960eef Merge 4.1 -> 5.0 2004-05-07 18:52:06 +02:00
guilhem@mysql.com
cd18476e34 Replication:
as the I/O thread filters on the server id, we must test replicate_same_server_id in it (on top of in the SQL thread).
2004-05-05 22:01:41 +02:00
guilhem@mysql.com
d20230bcbe very minor changes: a STOP SLAVE in a replication test to get rid of a non critical message in slave.err,
and a comment update
2004-05-05 21:50:51 +02:00
monty@mysql.com
d21d49a32a Merge with 4.0.19 2004-05-05 17:05:24 +03:00
guilhem@mysql.com
5fcd62a13a useless fixes for --report-password and --show-slave-auth-info (almost undocumented options),
just for beauty of truth.
2004-05-04 16:35:31 +02:00
serg@serg.mylan
dbc024deb5 compatibility fix (bug#3606) 2004-04-30 10:42:12 +02:00
guilhem@mysql.com
3fc39188ec A new option --replicate-same-server-id to force a slave to execute queries originating from itself
(WL#794). This can be of interest in some recovery-from-backup scenarios, and also when you have
two databases in one mysqld, having a certain similarity and you want one db to be updated when the other is
(some sort of trigger).
Plus small fix for BUG#3568 "MySQL server crashes when built --with-debug and CHANGE MASTER +MASTER_POS_WAIT"
2004-04-28 18:24:46 +02:00
monty@mishka.local
e9cfe01db0 After merge fixes
Changed 'SHOW FIELD STATUS' to use 'Engine' instead of 'Type'
2004-04-27 15:33:40 +03:00
monty@mishka.local
21fd1d270e Merge with 4.0 2004-04-26 15:53:31 +03:00
greg@mysql.com
493c81d6e9 Fixed compiler error in slave.cc on some platforms. 2004-04-21 10:04:38 -01:00
guilhem@mysql.com
066382e6e7 Fix for BUG#3461 "multi-table DELETE replicated despite replicate-wild-ignore-table":
In tables_ok(), when there is no table having "updating==TRUE" in the list,
    return that we don't replicate this statement (the slave is supposed to
    replicate *changes* only).
    In practice, the case can only happen for this statement:
    DELETE t FROM t,u WHERE ... ;
    tables_ok(t,u) will now return 0, which (check all_tables_not_ok())
    will give a chance to tables_ok(t) to run.
2004-04-13 22:40:16 +02:00
guilhem@mysql.com
c640a3904a Fix for BUG#3422 "In 3.23 -> 4.0 replication, slave segfault when replicating LOAD DATA INFILE":
as we transform the 3.23 Load_log_event into a 4.0 Create_file_log_event which is one
byte longer, we need to increment event_len. The bug was that we did not increment it,
so later in code the end 0 was not seen so there was for example a segfault in
strlen(fname) because fname was not 0-terminated.
Other problems remain in 3.23->4.0 replication of LOAD DATA INFILE but they are less serious:
Exec_master_log_pos and Relay_log_space are incorrect. I'll document them.
They are not fixable without significant code changes (if you fix those problems in 4.0,
you get assertion failures somewhere else etc), * which are already done in 5.0.0 *.
2004-04-08 22:12:22 +02:00
pem@mysql.com
dfd59e296e Merge 4.1 -> 5.0. 2004-04-07 19:07:44 +02:00
bell@sanja.is.com.ua
61fd95d168 Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-ps3-4.1
2004-04-07 15:23:05 +03:00
bell@sanja.is.com.ua
560a9f66d3 after review changes 2004-04-07 13:25:24 +03:00
guilhem@mysql.com
44a6fcba2f Fix for BUG#3401 "Rare replication bug which leads to "Binlog has bad magic number" from slave":
Backport of a part of this changeset of 4.1:
ChangeSet@1.1753.1.1, 2004-04-05 13:56:05+03:00, monty@mysql.com
which fixes the bug.
2004-04-07 01:14:11 +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
monty@mysql.com
42cf92ce37 Fixed many compiler warnings
Fixed bugs in group_concat with ORDER BY and DISTINCT (Bugs #2695, #3381 and #3319)
Fixed crash when doing rollback in slave and the io thread catched up with the sql thread
Set locked_in_memory properly
2004-04-05 13:56:05 +03:00
bell@sanja.is.com.ua
1e4af935c1 removed old way to prevent using stack tables for caching Items in PS
fixed error code in union test
2004-04-04 03:05:44 +03:00
monty@mysql.com
4bc6b551f8 false/true -> FALSE/TRUE
Fixes after last merge
2004-03-30 02:32:41 +03:00
serg@serg.mylan
d1f1bbefab sys_var_str.value is never NULL 2004-03-20 15:56:20 +01:00
monty@mysql.com
350b433569 merge with 4.0 2004-03-16 22:41:30 +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
cf287341cc Fix for BUG#2921 "Replication problem on mutex lock in mySQL-4.0.18":
re-using unused LOCK_active_mi to serialize all administrative
commands related to replication:
START SLAVE, STOP SLAVE, RESET SLAVE, CHANGE MASTER, init_slave()
(replication autostart at server startup), end_slave() (replication
autostop at server shutdown), LOAD DATA FROM MASTER.
This protects us against a handful of deadlocks (like BUG#2921
when two START SLAVE, but when two STOP SLAVE too).
Removing unused variables.
2004-03-11 16:23:35 +01:00
guilhem@mysql.com
1c0d5ad25c Backporting parts of
ChangeSet 1.1620.12.1 and ChangeSet 1.1625.2.1
from 4.1. This makes the slave I/O thread flush the relay log 
after every event, which provides additional safety in case
of brutal crash (reduces chances to lose a part of the relay log).
2004-03-10 16:56:28 +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
4ee44751d9 Fixed memory leak in DROP DATABASE when using RAID tables (Bug #2882) 2004-03-10 13:46:11 +02:00
guilhem@mysql.com
6cf1059f9d More comments on what could explain -1 in Seconds_Behind_Master in
SHOW SLAVE STATUS.
2004-03-02 23:03:52 +01:00
guilhem@mysql.com
db37d9a062 After hours of unsuccessful research on
BUG#2826 "Seconds behind master weirdness"
(sometimes this column of SHOW SLAVE STATUS shows a very big value,
in fact a small negative number casted to ulonglong).
This problem was reported by only one user, but which uses
synchronized time between his servers.
As suggested by the user, to hide this I display max(0, the value)
so that it will be less confusing. For a user, seeing 0 is probably
better than seeing -1 (both tell you that the slave is very close
to the master).
2004-03-02 22:38:14 +01:00
monty@mysql.com
ce14578909 Merge with 4.0.18 2004-02-11 00:06:46 +01:00
pem@mysql.com
c8585f3283 Merge 4.1 into 5.0. 2004-02-10 18:44:02 +01:00
guilhem@mysql.com
0c55118883 Fix for BUG#2452 "Empty LOAD DATA INFILE failes with the master in 3.23.x":
do not write the Execute_load_log_event if there was no Create_file_log_event
(empty file).
2004-01-20 15:41:22 -05:00
monty@mysql.com
8d23612303 Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/my/mysql-4.1
2003-12-26 12:32:24 +02:00
monty@mysql.com
458a947f6c Fixed bug in table level privilege GRANT handling. (Bug #2178)
Portability fixes
2003-12-26 12:32:02 +02:00
konstantin@oak.local
2a25b2617a Prepared_statement deployed instead of PREP_STMT. 2003-12-20 02:16:10 +03:00
guilhem@mysql.com
1333f636ae Merge gbichot@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/mysql_src/mysql-5.0-new-binlog-format
2003-12-19 23:05:07 +01:00
guilhem@gbichot2
df3b1a54f4 This is the final commit for Worklog tasks:
* A more dynamic binlog format which allows small changes (1064)
   * Log session variables in Query_log_event (1063)
It contains a few bugfixes (which I made when running the testsuite).
I carefully updated the results of the testsuite (i.e. I checked for every one,
if the difference between .reject and .result could be explained).
Apparently mysql-test-run --manager is broken in 4.1 and 5.0 currently,
so I could neither run the few tests which require --manager, nor check
that they pass nor modify their .result. But for builds, we don't run
with --manager.
Apart from --manager, the full testsuite passes, with Valgrind too (no errors).
I'm going to push in the next minutes. Remains: update the manual.
Note: by chance I saw that (in 4.1, in 5.0) rpl_get_lock fails when run alone;
this is normal at it makes assumptions on thread ids. I will fix this one day
in 4.1.
2003-12-19 22:40:23 +01:00
konstantin@oak.local
d37da004f6 THD::lex now points to THD::main_lex like in 5.0
All tests pass (client_test included)
2003-12-19 20:52:13 +03:00
pem@mysql.com
99e0ae85c7 Merge 4.1 to 5.0. 2003-12-19 18:03:27 +01:00
monty@mysql.com
d4c32db181 merge with 4.0.18 2003-12-19 16:42:17 +02:00
guilhem@gbichot2
66a32e8925 This will be pushed only after I fix the testsuite.
This is the main commit for Worklog tasks:
 * A more dynamic binlog format which allows small changes (1064)
 * Log session variables in Query_log_event (1063)
Below 5.0 means 5.0.0.
MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed),
SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think
of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this
works for queries, except LOAD DATA INFILE (for this it would have to wait
for Dmitri's push of WL#874, which in turns waits for the present push, so...
the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1,
5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1.
Apart from that, the new binlog format is designed so that it can tolerate
a little variation in the events (so that a 5.0.0 slave could replicate a
5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I
later add replication of charsets it should break nothing. And when I later
add a UID to every event, it should break nothing.
The main change brought by this patch is a new type of event, Format_description_log_event,
which describes some lengthes in other event types. This event is needed for
the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event,
we can later add more bytes to the header of every event without breaking compatibility.
Inside Query_log_event, we have some additional dynamic format, as every Query_log_event
can have a different number of status variables, stored as pairs (code, value); that's
how SQL_MODE and session variables and catalog are stored. Like this, we can later
add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows
if we want.
MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs.
Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs),
upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs);
so both can be "hot" upgrades.
Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0.
3.23 and 4.x can't be slaves of 5.0.
So downgrading from 5.0 to 4.x may be complicated.
Log_event::log_pos is now the position of the end of the event, which is
more useful than the position of the beginning. We take care about compatibility
with <5.0 (in which log_pos is the beginning).
I added a short test for replication of SQL_MODE and some other variables.
TODO:
- after committing this, merge the latest 5.0 into it
- fix all tests
- update the manual with upgrade notes.
2003-12-18 01:09:05 +01:00
guilhem@mysql.com
508d5e5b9d Fix for BUG#2145 "mysqld becomes unreliable if unable to create a relay log when replic starts":
release the mutex before exiting the function, or it will be kept forever
(=> START SLAVE, STOP SLAVE, etc will hang).
2003-12-17 23:29:11 +01:00
monty@mysql.com
e0cc6799ec Merge with 4.0.17 2003-12-17 17:35:34 +02:00
pem@mysql.com
24a2ae44a3 Merged 4.1 -> 5.0 2003-12-09 19:00:34 +01:00
gluh@gluh.mysql.r18.ru
a09d6409ae post-merge fixes 2003-12-08 09:44:04 +04:00
gluh@gluh.mysql.r18.ru
b46d75f08b Task ID 499:Add a new settable string variable(init_connect, init_slave)
to mysqld that is executed for all new connections.
(Similar to the client command: mysql_options(... MYSQL_INIT_COMMAND ...).
2003-12-08 09:13:14 +04:00
guilhem@mysql.com
dd2303ce07 - Fix for BUG#1858 "SQL-Thread stops working when using optimize table":
we change THD::system_thread from a 'bool' to a bitmap to be able to
distinguish between delayed-insert threads and slave threads.
- Fix for BUG#1701 "Update from multiple tables" (one line in sql_parse.cc,
plus a new test rpl_multi_update.test). That's just adding an initialization.
2003-12-04 22:42:18 +01:00
konstantin@mysql.com
f2377c4dc9 manual merge 2003-12-04 18:15:45 +03:00
guilhem@mysql.com
1b4bd22bd7 Fix for BUG#2011 "rare race condition producing "binlog has bad magic number" error in slave".
The problem was that when the slave SQL thread reads a hot relay log (hot = the one being written to by the
slave I/O thread), it must have the LOCK_log. It already took it for read_log_event(), but needs
it also for check_binlog_magic().
This should fix all recently reported failures of the rpl_max_relay_size test in 4.1 and 5.0
(though the bug exists since 4.0, it showed up first in 5.0).
2003-12-04 15:30:14 +01:00
pem@mysql.com
6e717133c5 Merge 4.1 to 5.0 2003-12-01 16:14:40 +01:00
guilhem@mysql.com
c9fd311aac In the slave I/O thread (in master.info), it seems less worse to flush
the relay log before flushing master.info.
Doing 'before' leads to duplicate event, doing after leads to missing event.
Both can be as destructive, but 'duplicate' enables us to later add detection
code to catch it. Whereas 'missing' can't be caught (it can't, because
the I/O thread can produce legal position jumps, for example if it has
ignored an event coming from this slave (rememember that starting from 4.1.1,
the I/O thread filters the server id).
2003-11-28 16:15:21 +01:00
konstantin@oak.local
c75bb0a654 Second attempt: trying to add Statement context to sources.
Added classes Statement, Statement_map
Merge commit
2003-11-27 20:51:53 +03:00
guilhem@gbichot2
05e5a35bf2 Replication:
Now the I/O thread (in flush_master_info()) flushes the relay log to disk
after reading every event. Slower but provides additionnal safety in case
of brutal crash.
I had to make the flush optional (i.e. add a if(some_bool_argument) in the function)
because sometimes flush_master_info() is called when there is no usable
relay log (the relay log's IO_CACHE is not initialized so can't be flushed).
2003-11-23 17:02:59 +01:00
paul@teton.kitebird.com
9b4050c406 Merge paul@bk-internal.mysql.com:/home/bk/mysql-4.1
into teton.kitebird.com:/home/paul/mysql-4.1
2003-11-21 23:02:06 -06:00
monty@mysql.com
d87494c5ac Don't flush cur_log (relay log) on flush_relay_log_info becasue this crashes the server if cur_log is 'hot' and the io_thread has changed log file.
Updated project files for windows
Made rpl_change_master.test portable
Ensure that mutex are not freed if not initilized
2003-11-22 03:21:40 +02:00
paul@teton.kitebird.com
7a1bb450a6 Change word order of a few PROCESSLIST messages to correspond
to order used in START SLAVE syntax.
2003-11-21 12:35:33 -06:00
paul@ice.snake.net
53c93091f2 Write slave status field names using consistent style.
(Initial caps for each word.) For example, instead of writing
Until_condition, Until_Log_File, and Until_log_pos, write
Until_Condition, Until_Log_File, and Until_Log_pos.
2003-11-20 13:07:25 -06:00
pem@mysql.com
28a2c6a96b Merging 4.1->5.0. 2003-11-19 15:19:46 +01:00
monty@narttu.mysql.fi
4e4725377d Merge with 4.0 2003-11-04 09:40:36 +02:00
guilhem@mysql.com
fbc54c139d When we delete the slave's temp tables from memory, we reset
rli->save_temporary_tables and slave_open_temp_tables
(in old 4.0 you could make "SHOW STATUS LIKE 'slave_open_temp_tables'" grow
indefinitely by doing RESET SLAVE and replicating always the same CREATE
TEMPORARY TABLE).
It's critical to reset save_temporary_tables to 0 (otherwise you may later
read memory which has been freed) so this changeset should go into 4.1.
2003-11-03 18:24:01 +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
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
pem@mysql.comhem.se
692609537d Post-merge fixes. 2003-10-23 16:06:51 +02:00
pem@mysql.com
337238b78a Merging 4.1->5.0 2003-10-22 16:10:22 +02:00
serg@serg.mylan
f944fd4a65 merged 2003-10-21 11:58:43 +02:00
guilhem@mysql.com
ce6d736714 A fix for a random test failure rpl_trunc_binlog: don't RESET MASTER
while the slave is connected.
2003-10-17 00:00:25 +02:00
monty@mashka.mysql.fi
e87c9f5ff8 merge with 4.0 2003-10-16 03:08:40 +03:00
monty@mashka.mysql.fi
84d9d98078 Better fix for CREATE TABLE IF NOT EXISTS ... SELECT
Fixed chsize() problem on windows
Extend default timeout on windows clients to 1 year (to avoid timeout problems)
2003-10-15 21:41:13 +03:00
serg@serg.mylan
50d9b95b77 merged 2003-10-15 12:25:44 +02:00
serg@serg.mylan
8cc3951c8f key_map with more that 64 bits width 2003-10-11 13:06:55 +02:00
guilhem@mysql.com
b2500829a3 Make the slave die if master is 5.0. Indeed, 5.0 masters send
a Format_description_log_event (or maybe it will be named
Description_log_event) which is not recognized by 4.0, so
a 4.0 can't be a slave of 5.0. We detect it early to produce
a helpful message instead of "corrupted relay log" later.
2003-10-09 17:40:38 +02:00
guilhem@gbichot2
c0075fa64b Final push for WL#1098:
"Add a column "Timestamp_of_last_master_event_executed" in SHOW SLAVE STATUS".
Finally this is adding
- Slave_IO_State (a copy of the State column of SHOW PROCESSLIST for the I/O thread,
so that the users, most of the time, has enough info with only SHOW SLAVE STATUS).
- Seconds_behind_master. When the slave connects to the master it does SELECT UNIX_TIMESTAMP()
on the master, computes the absolute difference between the master's and the slave's clock.
It records the timestamp of the last event executed by the SQL thread, and does a
small computation to find the number of seconds by which the slave is late.
2003-10-09 00:06:21 +02:00
monty@narttu.mysql.fi
d9ff665102 Fixes after merge 2003-10-08 12:01:58 +03:00
monty@narttu.mysql.fi
6056cfadfc Merge with 4.0.16 2003-10-07 15:42:26 +03:00