Commit graph

318 commits

Author SHA1 Message Date
Sergei Golubchik
f09ca00e08 merged 2010-03-15 12:51:23 +01:00
unknown
4bf849c23c Merge MySQL 5.1.44 into MariaDB. 2010-03-04 09:03:07 +01:00
unknown
e5099a2c85 merge 5.1->5.2 2010-02-01 08:14:12 +02:00
Andrei Elkin
a589499986 bug#47142
merging patches prepared for 5.0 to 5.1-bt. That caused a few changes in the test file
2010-01-27 19:27:49 +02:00
Andrei Elkin
29cd733fce bug#47142
improving comments
2010-01-27 15:20:03 +02:00
Andrei Elkin
cfa7e83d6d Bug #47142 "slave start until" stops 1 event too late in 4.1 to 5.0 replication
When replicating from 4.1 master to 5.0 slave START SLAVE UNTIL can stop too late.
The necessary in calculating of the beginning of an event the event's length
did not correspond to the master's genuine information at the event's execution time.
That piece of info was changed at the event's relay-logging due to binlog_version<4 event
conversion by IO thread.

Fixed with storing the master genuine Query_log_event size into a new status
variable at relay-logging of the event. The stored info is extacted at the event
execution and participate further to caclulate the correct start position of the event
in the until-pos stopping routine.
The new status variable's algorithm will be only active when the event comes
from the master of version < 5.0 (binlog_version < 4).


mysql-test/r/rpl_until.result:
  results changed.
mysql-test/std_data/bug47142_master-bin.000001:
  a binlog from 4.1 master to replace one of the running 5.x master is added as 
  part of Bug #47142 regression test.
mysql-test/t/rpl_until.test:
  Regression test for Bug #47142 is added.
sql/log_event.cc:
  Storing and extracting the master's genuine size of the event from the status
  var of the event packet header.
  The binlog_version<4 query-log-event is 
  a. converted into the modern binlog_version==4 to store the original size of the event
     into a new status var; the converted representation goes into the relay log.
  b. the converted event is read out and the stored size is engaged in the start pos calculation.
  
  The new status is active only for events that IO thread instantiates for the sake of the conversion.
sql/log_event.h:
  Incrementing the max szie of MAX_SIZE_LOG_EVENT_STATUS because of the new status var;
  Defining the new status variable to hold the master's genuine event size;
  Augmenting the Query_log_event with a new member to hold a value to store/extact from the status
  var of the event packet header.
2010-01-25 17:46:48 +02:00
Michael Widenius
d8ecbbe634 Merge with MySQL 5.1.42
- Marked a couple of tests with --big
- Fixed xtradb/handler/ha_innodb.cc to call explain_filename()

storage/xtradb/handler/ha_innodb.cc:
  Call explain_filename() to get proper names for partitioned tables
2010-01-15 17:27:55 +02:00
unknown
e813587b40 Bug #34628 LOAD DATA CONCURRENT INFILE drops CONCURRENT in binary log
'LOAD DATA CONCURRENT [LOCAL] INFILE ...' statment only is binlogged as
'LOAD DATA [LOCAL] INFILE ...' in SBR and MBR.  As a result, if replication is on, 
queries on slaves will be blocked by the replication SQL thread.

This patch write code to write 'CONCURRENT' into the log event if 'CONCURRENT' option
is in the original statement in SBR and MBR.
2009-12-15 13:14:14 +08:00
unknown
08e4635fba merge 5.1-> 5.2 2009-12-08 23:47:54 +02:00
unknown
a962160eec Merge with MySQL 5.1, with following additions:
- Moved some code from innodb_plugin to xtradb, to ensure that all tests runs
- Did changes in pbxt and maria storage engines becasue of changes in thd->query
- Reverted wrong code in sql_table.cc for how ROW_FORMAT is used.

This is a re-commit of Monty's merge to eliminate an extra commit from
MySQL-5.1.42 that was accidentally included in the merge.

This is a merge of the MySQL 5.1.41 clone-off (clone-5.1.41-build). In
case there are any extra changes done before final MySQL 5.1.41
release, these will need to be merged later before MariaDB 5.1.41
release.
2009-11-16 21:49:51 +01:00
Sergey Petrunya
b027072e01 MWL#36: Add a mysqlbinlog option to change the used database
- Review fixes

client/Makefile.am:
  - Make it build on Linux
client/mysqlbinlog.cc:
  - Coding style fixes
  - Better/more comments
  - Use client/sql_string.*, not server's sql/sql_string.*.
  - Don't declare a dummy TABLE_LIST structure in the client.
client/sql_string.h:
  - Use client/sql_string.*, not server's sql/sql_string.*.
sql/log_event.cc:
  = Fix coding style
  = Introduce Log_event::event_owns_temp_buf which tells whether Log_event::temp_buf is 'owned' by the Log_event object and should be my_free'd on return. 
  This is needed because rewrite_db() needs to dispose of the buffer, and 
  - when mysqlbinlog is reading directly from binlog file, the buffer 
    should be freed
  - when mysqlbinlog is reading from a server, the buffer is a part of network
    buffer and shouldn't be freed.
sql/log_event.h:
  Introduce Log_event::event_owns_temp_buf which tells whether Log_event::temp_buf is 'owned' by the Log_event object and should be my_free'd on return. 
  This is needed because rewrite_db() needs to dispose of the buffer, and 
  - when mysqlbinlog is reading directly from binlog file, the buffer 
    should be freed
  - when mysqlbinlog is reading from a server, the buffer is a part of network
    buffer and shouldn't be freed.
sql/mysqld.cc:
  - Better/more comments
sql/rpl_filter.cc:
  - #ifdef-out Rpl_filter::tables_ok from the client. This allows not 
    to define dummy TABLE_LIST on the client
sql/rpl_filter.h:
  - #ifdef-out Rpl_filter::tables_ok from the client. This allows not 
    to define dummy TABLE_LIST on the client
sql/sql_string.cc:
  - Use client/sql_string.*, not server's sql/sql_string.*.
sql/sql_string.h:
  - Use client/sql_string.*, not server's sql/sql_string.*.
2009-10-24 23:43:39 +04:00
Alfranio Correia
7e5cf52c3e BUG#48091 valgrind errors when slave has double not null and master has double null
Backporting BUG#43789 to mysql-5.1-bugteam
                              
The replication was generating corrupted data, warning messages on Valgrind
and aborting on debug mode while replicating a "null" to "not null" field.
Specifically the unpack_row routine, was considering the slave's table
definition and trying to retrieve a field value, where there was nothing to be
retrieved, ignoring the fact that the value was defined as "null" by the master.
                              
To fix the problem, we proceed as follows:
                              
1 - If it is not STRICT sql_mode, implicit default values are used, regardless
if it is multi-row or single-row statement.
                              
2 - However, if it is STRICT mode, then a we do what follows:
                              
2.1 If it is a transactional engine, we do a rollback on the first NULL that is
to be set into a NOT NULL column and return an error.
                              
2.2 If it is a non-transactional engine and it is the first row to be inserted
with multi-row, we also return the error. Otherwise, we proceed with the
execution, use implicit default values and print out warning messages.
                        
Unfortunately, the current patch cannot mimic the behavior showed by the master
for updates on multi-tables and multi-row inserts. This happens because such
statements are unfolded in different row events. For instance, considering the
following updates and strict mode:
                        
(master)
create table t1 (a int);
create table t2 (a int not null);
insert into t1 values (1);
insert into t2 values (2);
update t1, t2 SET t1.a=10, t2.a=NULL;
                        
t1 would have (10) and t2 would have (0) as this would be handled as a
multi-row update. On the other hand, if we had the following updates:
                        
(master)
create table t1 (a int);
create table t2 (a int);
                        
(slave)
create table t1 (a int);
create table t2 (a int not null);
                        
(master)
insert into t1 values (1);
insert into t2 values (2);
update t1, t2 SET t1.a=10, t2.a=NULL;
                        
On the master t1 would have (10) and t2 would have (NULL). On
the slave, t1 would have (10) but the update on t1 would fail.
2009-10-22 01:15:45 +01:00
Alexander Ivanov
ef5874d154 MWL#36: Add a mysqlbinlog option to change the used database.
Add rewrite_db() member to the Table_map_log_event class.
Each RBR-event in binary log is preceded by a Table_map event
containing a (db_id, db_name) pair. The rewrite_db(new_name)
function replaces db_name by new_name in a buffer containing
Table_map event read from the binary log.
2009-10-16 15:58:16 +04:00
Tatiana A. Nurnberg
4102363f37 Bug#43746: YACC return wrong query string when parse 'load data infile' sql statement
"load data" statements were written to the binlog as a mix of the original statement
and bits recreated from parse-info. This relied on implementation details and broke
with IGNORE_SPACES and versioned comments.

We now completely resynthesize the query for LOAD DATA for binlog (which among other
things normalizes them somewhat with regard to case, spaces, etc.).
We have already parsed the query properly, so we make use of that rather
than mix-and-match string literals and parsed items.
This should make us safe with regard to versioned comments, even those
spanning multiple tokens. Also no longer affected by IGNORE_SPACES.

mysql-test/r/mysqlbinlog.result:
  LOAD DATA INFILE normalized
mysql-test/suite/binlog/r/binlog_killed_simulate.result:
  LOAD DATA INFILE normalized
mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result:
  LOAD DATA INFILE normalized
mysql-test/suite/binlog/r/binlog_stm_blackhole.result:
  LOAD DATA INFILE normalized
mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result:
  LOAD DATA INFILE normalized
mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result:
  LOAD DATA INFILE normalized
mysql-test/suite/rpl/r/rpl_loaddata.result:
  LOAD DATA INFILE normalized
mysql-test/suite/rpl/r/rpl_loaddata_fatal.result:
  LOAD DATA INFILE normalized; offsets adjusted to reflect that
mysql-test/suite/rpl/r/rpl_loaddata_map.result:
  LOAD DATA INFILE normalized
mysql-test/suite/rpl/r/rpl_loaddatalocal.result:
  test for #43746 - trying to break LOAD DATA part of parser
mysql-test/suite/rpl/r/rpl_stm_log.result:
  LOAD DATA INFILE normalized
mysql-test/suite/rpl/t/rpl_loaddatalocal.test:
  try to break the LOAD DATA part of the parser (test for #43746)
mysql-test/t/mysqlbinlog.test:
  LOAD DATA INFILE normalized; adjust offsets to reflect that
sql/log_event.cc:
  clean up Load_log_event::print_query and friends so they don't print
  excess spaces. add support for printing charset names to print_query.
sql/log_event.h:
  We already have three places where we synthesize LOAD DATA queries.
  Better use one of those!
sql/sql_lex.h:
  When binlogging LOAD DATA statements, we make up the statement to
  be logged (from the parse-info, rather than substrings of the
  original query) now. Consequently, we no longer need (string-)
  pointers into the original query.
sql/sql_load.cc:
  Completely rewrote write_execute_load_query_log_event() to synthesize the
  LOAD DATA statement wholesale, rather than piece it together from
  synthesized bits and literal excerpts from the original query. This
  will not only give us a nice, normalized statement (all uppercase,
  no excess spaces, etc.), it will also handle comments, including
  versioned comments right, which is certainly more than we can say
  about the previous incarnation.
sql/sql_yacc.yy:
  We're no longer assembling LOAD DATA statements from bodyparts of the
  original query, so some bookkeeping in the parser can go.
2009-09-28 05:41:10 -07:00
Sergey Petrunya
29f0dcb563 Merge MySQL->MariaDB
* Finished Monty and Jani's merge
* Some InnoDB tests still fail (because it's old xtradb code run against
  newer testsuite). They are expected to go after mergning with the latest
  xtradb.
2009-09-08 00:50:10 +04:00
Luis Soares
38088ef6a4 merge: 5.1-bt bug branch --> 5.1-bt latest 2009-06-30 19:40:38 +01:00
unknown
4b2aafb35c Merge of Percona XtraDB into MariaDB. 2009-06-11 19:49:51 +02:00
unknown
93bcda598b Merge latest XtraDB from lp:percona-xtradb into MariaDB.
include/my_sys.h:
  Move generic file parsing functions out to shared code, as they are used in several places.
mysys/mf_iocache2.c:
  Move generic file parsing functions out to shared code, as they are used in several places.
sql/log_event.cc:
  Fix XtraDB build with embedded server.
  XtraDB needs access to replication stuff, which is missing in embedded server.
  Solved by defining wrapper function for this which is compiled differently for normal and
  embedded case.
sql/log_event.h:
  Fix XtraDB build with embedded server.
  XtraDB needs access to replication stuff, which is missing in embedded server.
  Solved by defining wrapper function for this which is compiled differently for normal and
  embedded case.
sql/slave.cc:
  Move generic file parsing functions out to shared code, as they are used in several places.
2009-06-11 14:53:26 +02:00
Luis Soares
1b1ca7fe38 BUG#42941: --database paramater to mysqlbinlog fails with RBR
mysqlbinlog --database parameter was being ignored when processing
row events. As such no event filtering would take place.
            
This patch addresses this by deploying a call to shall_skip_database
when table_map_events are handled (as these contain also the name of
the database). All other rows events referencing the table id for the
filtered map event, will also be skipped.

client/mysqlbinlog.cc:
  Added shall_skip_database call to the part of the code that handles 
  Table_map_log_events. It inspects the database name and decides whether
  to filter the event or not. Furthermore, if table map event is filtered
  next events referencing the table id in the table map event, will also
  be filtered.
mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_db_filter.test:
  Test case that checks if row events are actually filtered out.
sql/log_event.h:
  Added a map for holding the currently ignored table map events.
  Table map events are inserted when they shall be skipped and removed
  once the last row event in the statement is processed.
2009-06-07 23:28:08 +01:00
He Zhenxing
abf5f8dac2 BUG#41948 Query_log_event constructor needlessly contorted
Make the caller of Query_log_event, Execute_load_log_event
constructors and THD::binlog_query to provide the error code
instead of having the constructors to figure out the error code.

sql/log_event.cc:
  Changed constructors of Query_log_event and Execute_load_log_event to accept the error code argument instead of figuring it out by itself
sql/log_event.h:
  Changed constructors of Query_log_event and Execute_load_log_event to accept the error code argument
2009-05-30 21:32:28 +08:00
He Zhenxing
51a9116638 BUG#37145 Killing a statement doing DDL may log binlog event with error code 1053
When the thread executing a DDL was killed after finished its
execution but before writing the binlog event, the error code in
the binlog event could be set wrongly to ER_SERVER_SHUTDOWN or
ER_QUERY_INTERRUPTED.

This patch fixed the problem by ignoring the kill status when
constructing the event for DDL statements.

This patch also included the following changes in order to
provide the test case.

 1) modified mysqltest to support variable for connection command

 2) modified mysql-test-run.pl, add new variable MYSQL_SLAVE to
    run mysql client against the slave mysqld.
2009-03-27 13:19:50 +08:00
Ignacio Galarza
0d588edf61 auto-merge 2009-03-17 16:29:24 -04:00
He Zhenxing
b4fdb8aec1 BUG#37051 Replication rules not evaluated correctly
Backporting patch to 5.0.
2009-03-05 18:10:44 +08:00
Alfranio Correia
d822ab8957 BUG#38174 secure-file-priv breaks LOAD DATA INFILE replication in statement mode
If secure-file-priv was set on slave, it became unable to execute
LOAD DATA INFILE statements sent from master using mixed or
statement-based replication.
                  
This patch fixes the issue by ignoring this security restriction
and checking if the files are created and read by the slave in the
--slave-load-tmpdir while executing the SQL Thread.
2009-02-21 09:36:07 +00:00
Ignacio Galarza
5b7347bda3 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-13 11:41:47 -05:00
Luis Soares
df8543868d merge: 5.1 -> 5.1-rpl
conflicts:
  Text conflict in client/mysqltest.cc
  Text conflict in mysql-test/include/wait_until_connected_again.inc
  Text conflict in mysql-test/lib/mtr_report.pm
  Text conflict in mysql-test/mysql-test-run.pl
  Text conflict in mysql-test/r/events_bugs.result
  Text conflict in mysql-test/r/log_state.result
  Text conflict in mysql-test/r/myisam_data_pointer_size_func.result
  Text conflict in mysql-test/r/mysqlcheck.result
  Text conflict in mysql-test/r/query_cache.result
  Text conflict in mysql-test/r/status.result
  Text conflict in mysql-test/suite/binlog/r/binlog_index.result
  Text conflict in mysql-test/suite/binlog/r/binlog_innodb.result
  Text conflict in mysql-test/suite/rpl/r/rpl_packet.result
  Text conflict in mysql-test/suite/rpl/t/rpl_packet.test
  Text conflict in mysql-test/t/disabled.def
  Text conflict in mysql-test/t/events_bugs.test
  Text conflict in mysql-test/t/log_state.test
  Text conflict in mysql-test/t/myisam_data_pointer_size_func.test
  Text conflict in mysql-test/t/mysqlcheck.test
  Text conflict in mysql-test/t/query_cache.test
  Text conflict in mysql-test/t/rpl_init_slave_func.test
  Text conflict in mysql-test/t/status.test
2009-01-23 13:22:05 +01:00
Sven Sandberg
8576423de8 BUG#41924: high-level replication functions are not commented
Adding comments to some of the high-level functions in replication.

sql/log_event.h:
  Fixed some mistakes in comments.
sql/repl_failsafe.cc:
  Added comment for show_slave_hosts()
sql/slave.cc:
  Added comment for show_master_info(), handle_slave_[sql|io](), and next_event()
sql/sql_binlog.cc:
  Added @param comment.
sql/sql_lex.h:
  Added comment for st_lex_master_info.
sql/sql_repl.cc:
  Added comments for functions executing a statement:
      PURGE BINARY LOGS
      START SLAVE
      STOP SLAVE
      RESET SLAVE
      CHANGE MASTER
      RESET MASTER
      SHOW BINLOG EVENTS
      SHOW MASTER STATUS
      SHOW BINARY LOGS
2009-01-09 13:49:24 +01:00
Sven Sandberg
5c92f27f63 BUG#41961: Some log_event types do not skip post-header when reading
Problem: when the server reads a log_event from file, it should read
the post-header lengths from the format_description_log_event. Some
event types which currently have post-header length 0 did not do this,
and instead had a hard-coded zero length for the post-header. That
means the current server version will not be able to read future
versions of these events.
Fix: make the reader functions read the post-header.


sql/log_event.cc:
   - Made Format_description_log_event constructor initialize all
     post-header lengths explicitly, to make it easier to find them
     in the source code.
   - After this, it is no longer necessary to pass the MY_ZEROFILL
     flag to my_malloc. I removed the flag and added a sanity-check
     that will be executed only in debug-mode.
   - Made INTVAR, RAND, USER_VAR, and XID events skip post_header_len
     when reading from file.
sql/log_event.h:
  Added explicit defines for the lengths of all event types.
2009-01-09 10:48:01 +01:00
Sven Sandberg
ba835f89ba BUG#40482: server/mysqlbinlog crashes when reading invalid Incident_log_event
Problem: When an Incident_log_event contains a bad incident number on disk,
the server crashes with an assertion.
Fix: Don't validate input with assertions. Use errors.

mysql-test/include/cleanup_fake_relay_log.inc:
  Added auxiliary file to restore things that setup_fake_relay_log.inc did.
mysql-test/include/setup_fake_relay_log.inc:
  Added auxiliary file to setup replication from an existing relay log.
mysql-test/std_data/bug40482-bin.000001:
  Binlog file for rpl.rpl_binlog_corruption
mysql-test/suite/rpl/t/rpl_binlog_corruption.test:
  New test file.
sql/log_event.cc:
  Check that the incident number is correct at the time the event is constructed.
  Do not assert it at the time it is printed.
sql/log_event.h:
  Incident_log_event::is_valid() should verify that the incident number is valid.
sql/rpl_constants.h:
  Incident numbers should be hard-coded, since they may appear in files.
2008-12-29 17:04:10 +01:00
He Zhenxing
08399602a6 Auto Merge 2008-09-29 13:36:42 +08:00
He Zhenxing
bd35cfe22e BUG#38734 rpl_server_id2 sync_with_master failed
Rotate event is automatically generated and written when rotating binary
log or relay log. Rotate events for relay logs are usually ignored by slave
SQL thread becuase they have the same server id as that of the slave.
However, if --replicate-same-server-id is enabled, rotate event
for relay log would be treated as if it's a rotate event from master, and
would be executed by slave to update the rli->group_master_log_name and
rli->group_master_log_pos to a wrong value and cause the MASTER_POS_WAIT
function to fail and return NULL.

This patch fixed this problem by setting a flag bit (LOG_EVENT_RELAY_LOG_F)
in the event to tell the SQL thread to ignore these Rotate events generated
for relay logs.

This patch also added another binlog event flag bit (LOG_EVENT_ARTIFICIAL_F)
to distinquish faked events, the method used before this was by checking if
log_pos was zero.


sql/log.h:
  Add a member to MYSQL_BIN_LOG to distinguish binary log from relay log.
sql/log_event.cc:
  Change artificial_event member to LOG_EVENT_ARTIFICIAL_F flag
  
  If LOG_EVENT_RELAY_LOG_F is set in the event flags for a rotate event, ignore it when updating position
  
  Refactored the code in Rotate_log_event::do_update_pos
sql/log_event.h:
  Add LOG_EVENT_RELAY_LOG_F flag to Log_event flags
  Add RELAY_LOG flag to Rotate_log_event flags
sql/sql_repl.cc:
  Set LOG_EVENT_ARTIFICIAL_F for fake rotate events
2008-09-28 15:34:25 +08:00
Mats Kindahl
84b81e6c95 Merging 5.1 into 5.1-rpl-merge 2008-08-27 20:52:44 +02:00
He Zhenxing
923f61039e Cherry picking patch for BUG#37051 2008-08-26 18:01:49 +08:00
Alexander Barkov
762df2d05c Additional fix for bug#31455 (rpl decoder)
- Implementing --base64-format=decode-rows, to display
  SQL-alike decoded row events without their BINLOG statements.
- Adding --base64-format=decode-rows into tests when
  calling mysqlbinlog to avoid non-deterministic results
- Removing resetting of last_table_id in "RESET MASTER",
  which appeared to be dangerous.
2008-08-21 16:47:23 +05:00
Alexander Barkov
0c5bc2eafc Bug#31455 mysqlbinlog don't print user readable info about RBR events
Implementing -v command line parameter to mysqlbinlog
to decode and print row events.

mysql-test/include/mysqlbinlog_row_engine.inc
mysql-test/r/mysqlbinlog_row.result
mysql-test/r/mysqlbinlog_row_big.result
mysql-test/r/mysqlbinlog_row_innodb.result
mysql-test/r/mysqlbinlog_row_myisam.result
mysql-test/r/mysqlbinlog_row_trans.result
mysql-test/t/mysqlbinlog_row.test
mysql-test/t/mysqlbinlog_row_big.test
mysql-test/t/mysqlbinlog_row_innodb.test
mysql-test/t/mysqlbinlog_row_myisam.test
mysql-test/t/mysqlbinlog_row_trans.test
  Adding tests 

client/Makefile.am
  Adding new files to symlink
  
client/mysqlbinlog.cc
  Adding -v option

sql/log_event.cc
  Impelentations of the new methods

sql/log_event.h
  Declaration of the new methods and member

sql/mysql_priv.h
  Adding new function prototype

sql/rpl_tblmap.cc
  Adding pre-processor conditions 

sql/rpl_tblmap.h
  Adding pre-processor conditions 

sql/rpl_utility.h
  Adding pre-processor conditions 

sql/sql_base.cc
  Adding reset_table_id_sequence() function.

sql/sql_repl.cc
  Resetting table_id on "RESET MASTER"
  
.bzrignore
  Ignoring new symlinked files
2008-08-20 19:06:31 +05:00
He Zhenxing
a018e98cba BUG#37051 Replication rules not evaluated correctly
The problem of this bug is that we need to get the list of tables
to be updated for a multi-table update statement, which requires to
open all the tables referenced by the statement and resolve all
the fields involved in update in order to figure out the list of
tables for update. However if there are replicate filter rules,
some tables might not exist on slave and result in a failure
before we could examine the filter rules.

I think the whole problem can not be solved on slave alone,
the master must record and send the information of tables
involved for update to slave, so that the slave do not need to
open all the tables referenced by the multi-table update statement to
figure out which tables are involved for update.

So a status variable is added to Query_log event to store the
value of table map for update on master. And on slave, it will
try to get the value of this variable and use it to examine
filter rules without opening any tables on slave, if this values
is not available, the old approach is used and thus the bug will
still occur for when replicating from old masters.


sql/sql_class.h:
  add member table_map_for_update to THD
sql/sql_parse.cc:
  check filter rules by using table_map_for_update value
sql/sql_update.cc:
  save the value of table_map_for_update
2008-07-31 14:24:27 +08:00
unknown
2e12a17d17 Merge mkindahl@bk-internal.mysql.com:/home/bk/mysql-5.1-bugteam
into  mats-laptop.(none):/home/bk/b29020-mysql-5.1-rpl


mysql-test/suite/binlog/r/binlog_base64_flag.result:
  Auto merged
mysql-test/suite/binlog/t/binlog_base64_flag.test:
  Auto merged
mysql-test/suite/rpl/r/rpl_row_create_table.result:
  Auto merged
sql/log.cc:
  Auto merged
sql/log_event.cc:
  Auto merged
sql/log_event.h:
  Auto merged
sql/sql_insert.cc:
  Auto merged
2008-03-28 14:52:33 +01:00
unknown
f56d77dadf BUG#29020 (Event results not correctly replicated to slave in RBR):
The bug allow multiple executing transactions working with non-transactional
to interfere with each others by interleaving the events of different trans-
actions.

Bug is fixed by writing non-transactional events to the transaction cache and
flushing the cache to the binary log at statement commit. To mimic the behavior
of normal statement-based replication, we flush the transaction cache in row-
based mode when there is no committed statements in the transaction cache,
which means we are committing the first one. This means that it will be written
to the binary log as a "mini-transaction" with just the rows for the statement.

Note that the changes here does not take effect when building the server with
HAVE_TRANSACTIONS set to false, but it is not clear if this was possible before
this patch either.

For row-based logging, we also have that when AUTOCOMMIT=1, the code now always
generates a BEGIN/COMMIT pair for single statements, or BEGIN/ROLLBACK pair in the
case of non-transactional changes in a statement that was rolled back. Note that
for the case where changes to a non-transactional table causes a rollback due
to error, the statement will now be logged with a BEGIN/ROLLBACK pair, even
though some changes has been committed to the non-transactional table.


mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test:
  Removing SHOW BINLOG EVENTS causing test to be non-deterministic.
mysql-test/r/ctype_cp932_binlog_row.result:
  Result change.
mysql-test/suite/binlog/r/binlog_base64_flag.result:
  Result change.
mysql-test/suite/binlog/r/binlog_multi_engine.result:
  Result file change.
mysql-test/suite/binlog/r/binlog_row_binlog.result:
  Result file change.
mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result:
  Result file change.
mysql-test/suite/binlog/r/binlog_row_insert_select.result:
  Result file change.
mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result:
  Result file change.
mysql-test/suite/binlog/r/binlog_stm_binlog.result:
  Result file change.
mysql-test/suite/binlog/t/binlog_base64_flag.test:
  Removing table that will be used in test to prevent failing if preceeding
  tests forgot to drop the table.
mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result:
  Result file change.
mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result:
  Result file change.
mysql-test/suite/rpl/r/rpl_row_create_table.result:
  Result file change.
mysql-test/suite/rpl/r/rpl_row_delayed_ins.result:
  Result file change.
mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result:
  Result file change.
mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result:
  Result file change.
mysql-test/suite/rpl/r/rpl_row_log.result:
  Result file change.
mysql-test/suite/rpl/r/rpl_row_log_innodb.result:
  Result file change.
mysql-test/suite/rpl/r/rpl_row_until.result:
  Result file change.
mysql-test/suite/rpl/r/rpl_slave_skip.result:
  Result file change.
mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result:
  Result file change.
mysql-test/suite/rpl/r/rpl_truncate_2myisam.result:
  Result file change.
mysql-test/suite/rpl/t/rpl_row_create_table.test:
  Binlog position change.
mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test:
  Binlog position change.
mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test:
  Binlog position change. Added stop position to mysqlbinlog argments to prevent
  extreneous output.
mysql-test/suite/rpl/t/rpl_row_until.test:
  Binlog position change.
mysql-test/suite/rpl/t/rpl_slave_skip.test:
  Binlog position change.
mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test:
  Removing extreneous SHOW BINLOG EVENTS causing test to be non-deterministic.
mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result:
  Result change.
sql/log.cc:
  Adding variable at_least_one_stmt to denote that there is at least one
  statement committed to the transaction cache (but there might be more).
  
  Removing duplicate checks from binlog_end_trans(). The transaction cache
  should always be committed or rolled back when this function is called.
  
  Correcting conditions for binlog_rollback() and binlog_commit() and removing
  the previous "invisible commit" in favor of always using explicit commits
  in the binary log.
sql/log_event.cc:
  Marking table map event to be cached. Removing Muted_query_log_event from code.
sql/log_event.h:
  Removing unused class Muted_query_log_event.
sql/sql_insert.cc:
  Adding missing call to ha_autocommit_or_rollback() for delayed thread. Marking
  CREATE-SELECT statements as transactional, since they don't need to be logged.
2008-03-28 13:16:41 +01:00
unknown
875ad6d8b8 BUG#31168: @@hostname does not replicate
Problem: in mixed and statement mode, a query that refers to a
system variable will use the slave's value when replayed on
slave. So if the value of a system variable is inserted into a
table, the slave will differ from the master.
Fix: mark statements that refer to a system variable as "unsafe",
meaning they will be replicated by row in mixed mode and produce a warning
in statement mode. There are some exceptions: some variables are actually
replicated. Those should *not* be marked as unsafe.
BUG#34732: mysqlbinlog does not print default values for auto_increment variables
Problem: mysqlbinlog does not print default values for some variables,
including auto_increment_increment and others. So if a client executing
the output of mysqlbinlog has different default values, replication will
be wrong.
Fix: Always print default values for all variables that are replicated.
I need to fix the two bugs at the same time, because the test cases would
fail if I only fixed one of them.


include/m_ctype.h:
  Added definition of ILLEGAL_CHARSET_INFO_NUMBER. We just need a symbol
  for a number that will never be used by any charset. ~0U should be safe
  since charset numbers are sequential, starting from 0.
mysql-test/include/commit.inc:
  Upated test to avoid making statements unsafe.
mysql-test/r/commit_1innodb.result:
  Updated test needs updated result file.
mysql-test/r/mysqlbinlog.result:
  Updated result file.
mysql-test/r/mysqlbinlog2.result:
  Updated result file.
mysql-test/r/user_var-binlog.result:
  Updated result file.
mysql-test/suite/binlog/r/binlog_base64_flag.result:
  Updated result file.
mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result:
  Updated result file.
mysql-test/suite/binlog/r/binlog_unsafe.result:
  Modified test file needs modified result file.
mysql-test/suite/binlog/t/binlog_base64_flag.test:
  Need to filter out pseudo_thread_id from result since it is
  nondeterministic.
mysql-test/suite/binlog/t/binlog_unsafe.test:
  Add tests that using variables is unsafe. The 'CREATE VIEW' tests didn't
  make sense, so I removed them. SHOW WARNINGS is not necessary either,
  because we get warnings for each statement in the result file.
mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result:
  Updated result file.
mysql-test/suite/rpl/r/rpl_skip_error.result:
  Updated result file.
mysql-test/suite/rpl/t/rpl_skip_error.test:
  The test used @@server_id, which is not safe to replicate, so it would
  have given a warning. The way it used @@server_id was hackish (issue a
  query on master that removes rows only on master), so I replaced it by a
  more robust way to do the same thing (connect to slave and insert the
  rows only there).
  Also clarified what the test case does.
mysql-test/t/mysqlbinlog2.test:
  Use --short-form instead of manually filtering out nondeterministic stuff
  from mysqlbinlog (because we added the nondeterministic @@pseudo_thread_id
  to the output).
sql/item_func.cc:
  Added method of Item_func_get_system_var that indicates whether the given
  system variable will be written to the binlog or not.
sql/item_func.h:
  Added method of Item_func_get_system_var that indicates whether the given
  system variable will be written to the binlog or not.
sql/log_event.cc:
   - auto_increment_offset was not written to the binlog if
  auto_increment_increment=1
   - mysqlbinlog did not output default values for some variables
  (BUG#34732). In st_print_event_info, we remember for each variable whether
  it has been printed or not. This is achieved in different ways for
  different variables:
      - For auto_increment_*, lc_time_names, charset_database_number,
        we set the default values in st_print_event_info to something
        illegal, so that it will look like they have changed the first time
        they are seen.
      - For charset, sql_mode, pseudo_thread_id, we add a flag to
        st_print_event_info which indicates whether the variable has been
        printed.
      - Since pseudo_thread_id is now printed more often, and its value is
        not guaranteed to be constant across different runs of the same
        test script, I replaced it by a constant if --short-form is used.
   - Moved st_print_event_info constructor from log_event.h to log_event.cc,
  since it now depends on ILLEGAL_CHARSET_NUMBER, which is defined in
  m_ctype.h, which is better to include from a .cc file than from a header
  file.
sql/log_event.h:
  Added fields to st_print_event_info that indicate whether some of the
  variables have been written or not. Since the initialization of
  charset_database_number now depends on ILLEGAL_CHARSET_INFO_NUMBER, which
  is defined in a header file, which we'd better not include from this
  header file -- I moved the constructor from here to log_event.cc.
sql/set_var.cc:
  System variables now have a flag binlog_status, which indicates if they
  are written to the binlog. If nothing is specified, all variables are
  marked as not written to the binlog (NOT_IN_BINLOG) when created. In this
  file, the variables that are written to the binlog are marked with
  SESSION_VARIABLE_IN_BINLOG.
sql/set_var.h:
  Added flag binlog_status to class sys_var. Added a getter and a
  constructor parameter that sets it.
  Since I had to change sys_var_thd_enum constructor anyways, I simplified
  it to use default values of arguments instead of three copies of the
  constructor.
sql/sql_yacc.yy:
  Mark statements that refer to a system variable as "unsafe",
  meaning they will be replicated by row in mixed mode. Added comment to
  explain strange piece of code just above.
mysql-test/include/diff_tables.inc:
  New auxiliary test file that tests whether two tables (possibly one on
  master and one on slave) differ.
mysql-test/suite/rpl/r/rpl_variables.result:
  New test case needs new result file.
mysql-test/suite/rpl/r/rpl_variables_stm.result:
  New test file needs new result file.
mysql-test/suite/rpl/t/rpl_variables.test:
  Test that INSERT of @@variables is replicated correctly (by switching to
  row-based mode).
mysql-test/suite/rpl/t/rpl_variables_stm.test:
  Test that replication of @@variables which are replicated explicitly works
  as expected in statement mode (without giving warnings).
2008-03-07 13:59:36 +01:00
unknown
6988f45e6b WL#4078: Document binary format of binlog entries
Minor update with corrections and notes on the binlog format.
This only affects comments, not code.


sql/log_event.h:
  Fixes in documentation of binlog format.
2008-02-20 14:52:21 +01:00
unknown
187e5c5fa3 WL#4078: Document binary format of binlog entries
Documented Table_map_log_event and packed integer format. Improved
other documentation. No change outside comments.


sql/log_event.h:
  Documented Table_map_log_event and packed integer format. Improved
  other documentation. No change outside comments.
2008-02-07 19:21:23 +01:00
unknown
d4e3ab9cf6 Merge riska.(none):/home/sven/bktip/5.1-new-rpl
into  riska.(none):/home/sven/bk/b34141-mysqlbinlog_4.1_binlogs/5.1-new-rpl


sql/log_event.cc:
  Auto merged
sql/log_event.h:
  Auto merged
2008-02-04 14:37:34 +01:00
unknown
64dbfdd7db Merge mysql1000.(none):/mnt/nb/home/elkin/MySQL/TEAM/FIXES/5.1/bug32971-error_propag_slave
into  mysql1000.(none):/home/andrei/MySQL/FIXES/5.1/bug32971-rbr_error_prop


mysql-test/extra/rpl_tests/rpl_row_tabledefs.test:
  Auto merged
sql/log_event.cc:
  Auto merged
sql/log_event.h:
  Auto merged
mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result:
  manual merge use local
mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result:
  manual merge use local
2008-01-31 17:02:29 +02:00
unknown
b6ec38cecc Bug #32971 No user level error message from slave sql thread when ER_NO_DEFAULT_FOR_FIELD
The error message due to lack of the default value for an extra field
was not as informative as it should be.

Fixed with improving the scheme of gathering, propagating and reporting
errors in applying rows events. 
The scheme is in the following.
Any kind of error of processing of a row event incidents are to be 
registered with my_error().
In the end Rows_log_event::do_apply_event() invokes rli->report() with the 
message to display consisting of all the errors.
This mimics `show warnings' displaying.
A simple test checks three errors in processing an event.
Two hunks - a user level error and pushing it into the list - 
have been devoted to already fixed Bug@31702.

Some open issues relating to this artifact listed on BUG@21842 page and
on WL@3679.
Todo: to synchronize the statement in the tests comments on Update and Delete
events may not stop when an extra field does not have a default with wl@3228 spec.


include/my_base.h:
  A new handler level error code that is supposed to be mapped to a set of more
  specific ER_ user level errors.
mysql-test/extra/rpl_tests/rpl_row_tabledefs.test:
  Adding yet another extra fields to see more than one error in show
  slave status' report.
mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result:
  results changed (the error message etc)
mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result:
  results changed
sql/log_event.cc:
  Refining slave_rows_error_report to iterate on the list of gathered errors;
  Simplifying signature of prepare_record as the function does not call
  rli->report to leave that duty to the event's top level code.
sql/log_event.h:
  adding a corrupt event error pushing. The error will be seen with
  show slave status.
sql/log_event_old.cc:
  similar to log_event.cc changes
sql/rpl_record.cc:
  prepare_record only pushes an error to the list
sql/rpl_record.h:
  signature changed
sql/share/errmsg.txt:
  The user level error code that corresponds to HA_ERR_CORRUPT_EVENT.
  The error will be reported in show slave status if such a failure happens.
2008-01-31 14:54:03 +02:00
unknown
101c30ccc4 Post-merge changes.
BitKeeper/deleted/.del-show_binlog_events2.inc:
  Delete: mysql-test/include/show_binlog_events2.inc
client/mysqlbinlog.cc:
  char -> uchar for raw memory.
sql/item_cmpfunc.cc:
  Adding cast to remove warning when converting negative integer
  to unsigned type.
sql/log_event.cc:
  char -> uchar for raw memory.
sql/log_event.h:
  char -> uchar for raw memory.
sql/rpl_utility.cc:
  Adding cast to remove warning when converting negative integer
  to unsigned type.
sql/slave.cc:
  char -> uchar for raw memory.
sql/sql_repl.cc:
  char -> uchar for raw memory.
sql-common/client.c:
  char -> uchar for raw memory.
2008-01-30 16:03:00 +01:00
unknown
ed9e73077d BUG#34141: mysqlbinlog cannot read 4.1 binlogs containing load data infile
Main problem: mysql 5.1 cannot read binlogs from 4.1.
Subproblem 1: There is a mistake in sql_ex_info::init. The read_str()
function updates its first argument to point to the next character to
read. However, it is applied only to a copy of the buffer pointer, so the
real buffer pointer is not updated.
Fix 1: do not take a copy of the buffer pointer. The copy was needed
because sql_ex_info::init does not use the const attribute on some of its
arguments. So we add the const attribute, too.
Subproblem 2: The first BINLOG statement is asserted to be a
FORMAT_DESCRIPTION_LOG_EVENT, but 4.1 binlogs begin with START_EVENT_V3.
Fix 2: allow START_EVENT_V3 too.


mysql-test/suite/binlog/std_data/binlog_old_version_4_1.000001:
  New BitKeeper file ``mysql-test/suite/binlog/std_data/binlog_old_version_4_1.000001''
mysql-test/suite/binlog/r/binlog_old_versions.result:
  Updated result file.
mysql-test/suite/binlog/t/binlog_old_versions.test:
  Added a test reading an old 4.1 binlog.
sql/log_event.cc:
  1. Added const keyword at the following places:
   - input buffer for pretty_print_str
   - input buffer for write_str
   - input buffer, end pointer, and return value from sql_ex_info::init
  2. Fixed the bug by not taking a copy of buf before calling read_str in
  sql_ex_info::init().
sql/log_event.h:
  Added const keyword to fields of the sql_ex_info struct.
  Added const keyword to arguments and return value of sql_ex_info::init
sql/sql_binlog.cc:
  The first BINLOG statement must describe the format for future BINLOG
  statements. Otherwise, we do not know how to read the BINLOG statement.
  Problem: only FORMAT_DESCRIPTION_EVENT is currently allowed as the first
  event. Binlogs from 4.1 begin with a START_EVENT_V3, which serves the
  same purpose.
  Fix: We now allow the first BINLOG statement to be a START_EVENT_V3, as
  well as a FORMAT_DESCRIPTION_EVENT.
2008-01-30 14:12:40 +01:00
unknown
3a6e84a2b3 BUG#27779: Slave cannot read old rows log events.
Problem: Replication fails when master is mysql-5.1-wl2325-5.0-drop6 and
slave is mysql-5.1-new-rpl. The reason is that, in
mysql-5.1-wl2325-5.0-drop6, the event type id's were different than in
mysql-5.1-new-rpl.
Fix (in mysql-5.1-new-rpl):
 (1) detect that the server that generated the events uses the old
format, by checking the server version of the format_description_log_event
This patch recognizes mysql-5.1-wl2325-5.0-drop6p13-alpha,
mysql-5.1-wl2325-5.0-drop6, mysql-5.1-wl2325-5.0, mysql-5.1-wl2325-no-dd.
 (2) if the generating server is old, map old event types to new event
types using a permutation array.

I've also added a test case which reads binlogs for four different
versions.


mysql-test/suite/binlog/std_data/binlog_old_version_5_1-telco.000001:
  BitKeeper file /home/sven/bk/b27779-old_row_events/5.1-new-rpl/mysql-test/suite/binlog/std_data/binlog_old_version_5_1-telco.000001
mysql-test/suite/binlog/std_data/binlog_old_version_5_1-wl2325_row.000001:
  BitKeeper file /home/sven/bk/b27779-old_row_events/5.1-new-rpl/mysql-test/suite/binlog/std_data/binlog_old_version_5_1-wl2325_row.000001
mysql-test/suite/binlog/std_data/binlog_old_version_5_1-wl2325_stm.000001:
  BitKeeper file /home/sven/bk/b27779-old_row_events/5.1-new-rpl/mysql-test/suite/binlog/std_data/binlog_old_version_5_1-wl2325_stm.000001
mysql-test/suite/binlog/std_data/binlog_old_version_5_1_17.000001:
  BitKeeper file /home/sven/bk/b27779-old_row_events/5.1-new-rpl/mysql-test/suite/binlog/std_data/binlog_old_version_5_1_17.000001
mysql-test/suite/binlog/std_data/binlog_old_version_5_1_23.000001:
  BitKeeper file /home/sven/bk/b27779-old_row_events/5.1-new-rpl/mysql-test/suite/binlog/std_data/binlog_old_version_5_1_23.000001
sql/log_event.cc:
  Added code to read events generated by
  mysql-5.1-wl2325-5.0-drop6p13-alpha, mysql-5.1-wl2325-5.0-drop6,
  mysql-5.1-wl2325-5.0, mysql-5.1-wl2325-no-dd.
  More precisely, the event type id's had different numbers in
  those versions. To fix, we add a permutation array which maps old_id to
  new_id when the format_description_log_event indicates that the
  originating server is of the old type. We also need to permute the
  post_header_len array accordingly.
sql/log_event.h:
  sql/log_event.h@1.169, 2008-01-09 11:34:37+01:00, sven@riska.(none) +5 -1
  Added declaration needed in log_event.cc. Also, the destructor of
  Format_description_log_event is sometimes called when post_header_len is
  null, so we must pass the MY_ALLOW_ZERO_PTR flag to my_free.
mysql-test/suite/binlog/r/binlog_old_versions.result:
  Result file for new test.
mysql-test/suite/binlog/t/binlog_old_versions.test:
  New test case that loads binlogs from several old versions.
2008-01-10 16:39:44 +01:00
unknown
8d37a30eac BUG#32407: Impossible to do point-in-time recovery from older binlog
Problem: it is unsafe to read base64-printed events without first
reading the Format_description_log_event (FD).  Currently, mysqlbinlog
cannot print the FD.

As a side effect, another bug has also been fixed: When mysqlbinlog
--start-position=X was specified, no ROLLBACK was printed. I changed
this, so that ROLLBACK is always printed.

This patch does several things:

 - Format_description_log_event (FD) now print themselves in base64
   format.

 - mysqlbinlog is now able to print FD events.  It has three modes:
    --base64-output=auto    Print row events in base64 output, and print
                            FD event.  The FD event is printed even if
                            it is outside the range specified with
                            --start-position, because it would not be
                            safe to read row events otherwise. This is
                            the default.

    --base64-output=always  Like --base64-output=auto, but also print
                            base64 output for query events.  This is
                            like the old --base64-output flag, which
                            is also a shorthand for
                            --base64-output=always

    --base64-output=never   Never print base64 output, generate error if
                            row events occur in binlog.  This is
                            useful to suppress the FD event in binlogs
                            known not to contain row events (e.g.,
                            because BINLOG statement is unsafe,
                            requires root privileges, is not SQL, etc)

 - the BINLOG statement now handles FD events correctly, by setting
   the thread's rli's relay log's description_event_for_exec to the
   loaded event.

   In fact, executing a BINLOG statement is almost the same as reading
   an event from a relay log.  Before my patch, the code for this was
   separated (exec_relay_log_event in slave.cc executes events from
   the relay log, mysql_client_binlog_statement in sql_binlog.cc
   executes BINLOG statements).  I needed to augment
   mysql_client_binlog_statement to do parts of what
   exec_relay_log_event does.  Hence, I did a small refactoring and
   moved parts of exec_relay_log_event to a new function, which I
   named apply_event_and_update_pos.  apply_event_and_update_pos is
   called both from exec_relay_log_event and from
   mysql_client_binlog_statement.

 - When a non-FD event is executed in a BINLOG statement, without
   previously executing a FD event in a BINLOG statement, it generates
   an error, because that's unsafe.  I took a new error code for that:
   ER_NO_FORMAT_DESCRIPTION_EVENT_BEFORE_BINLOG_STATEMENTS.

   In order to get a decent error message containing the name of the
   event, I added the class method char*
   Log_event::get_type_str(Log_event_type type), which returns a
   string name for the given Log_event_type.  This is just like the
   existing char* Log_event::get_type_str(), except it is a class
   method that takes the log event type as parameter.

   I also added PRE_GA_*_ROWS_LOG_EVENT to Log_event::get_type_str(),
   so that names of old rows event are properly printed.

 - When reading an event, I added a check that the event type is known
   by the current Format_description_log_event. Without this, it may
   crash on bad input (and I was struck by this several times).

 - I patched the following test cases, which all contain BINLOG
   statements for row events which must be preceded by BINLOG
   statements for FD events:
    - rpl_bug31076

While I was here, I fixed some small things in log_event.cc:

 - replaced hard-coded 4 by EVENT_TYPE_OFFSET in 3 places

 - replaced return by DBUG_VOID_RETURN in one place

 - The name of the logfile can be '-' to indicate stdin.  Before my
   patch, the code just checked if the first character is '-'; now it
   does a full strcmp().  Probably, all arguments that begin with a -
   are already handled somewhere else as flags, but I still think it
   is better that the code reflects what it is supposed to do, with as
   little dependencies as possible on other parts of the code.  If we
   one day implement that all command line arguments after -- are
   files (as most unix tools do), then we need this.

I also fixed the following in slave.cc:

 - next_event() was declared twice, and queue_event was not static but
   should be static (not used outside the file).


client/client_priv.h:
  Declared the new option for base64 output.
client/mysqlbinlog.cc:
   - Change from using the two-state command line option
    "default/--base64-output" to the three-state
    "--base64-output=[never|auto|always]"
   - Print the FD event even if it is outside the --start-position range.
   - Stop if a row event is about to be printed without a preceding FD
     event.
   - Minor fixes:
      * changed 4 to EVENT_TYPE_OFFSET in some places
      * Added comments
      * before, "mysqlbinlog -xyz" read from stdin; now it does not
        (only "mysqlbinlog -" reads stdin).
mysql-test/r/mysqlbinlog2.result:
  Updated result file: mysqlbinlog now prints ROLLBACK always.
mysql-test/suite/binlog/t/disabled.def:
  The test must be disabled since it reveals another bug: see BUG#33247.
mysql-test/suite/rpl/r/rpl_bug31076.result:
  Updated result file
mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result:
  Updated result file
mysql-test/suite/rpl/t/rpl_bug31076.test:
  Had to add explicit Format_description_log_event before other BINLOG
  statements
mysql-test/t/mysqlbinlog2.test:
  we must suppress base64 output in result file because it contains a
  timestamp
sql/log_event.cc:
   - Made FD events able to print themselves
   - Added check that the current FD event knows about the event type, when
     an event is about to be read. (Hint to reviewers: I had to re-indent
     a big block because of this; use diff -b)
      * To get a decent error message, I also added a class method
        const char* Log_event::get_type_str(Log_event_type)
        which converts number to event type string without having a
        Log_event object.
      * Made Log_event::get_type_str aware of PRE_GA_*_ROWS_LOG_EVENT.
   - Minor fixes:
      * Changed return to DBUG_VOID_RETURN
sql/log_event.h:
   - Declared enum to describe the three base64_output modes
   - Use the enum instead of a flag
   - Declare the new class method get_type_str (see log_event.cc)
sql/share/errmsg.txt:
  Added error msg.
sql/slave.cc:
   - Factored out part of exec_relay_log_event to the new function
     apply_event_and_update_pos, because that code is needed when executing
     BINLOG statements. (this is be functionally equivalent to the
     previous code, except: (1) skipping events is now optional, controlled
     by a parameter to the new function (2) the return value of
     exec_relay_log_event has changed; see next item).
   - Changed returned error value to always be 1. Before, it would return
     the error value from apply_log_event, which was unnecessary. This
     change is safe because the exact return value of exec_relay_log_event
     is never examined; it is only tested to be ==0 or !=0.
   - Added comments describing exec_relay_log_event and
     apply_event_and_update_pos.
   - Minor fixes:
      * Removed duplicate declaration of next_event, made queue_event
        static.
      * Added doxygen code to include this file.
sql/slave.h:
  Declared the new apply_event_and_update_pos
sql/sql_binlog.cc:
   - Made mysql_binlog_statement set the current FD event when the given
     event is an FD event. This entails using the new function
     apply_event_and_update_pos from slave.cc instead of just calling the
     ev->apply method.
   - Made mysql_binlog_statement fail if the first BINLOG statement is not
     an FD event.
mysql-test/suite/binlog/r/binlog_base64_flag.result:
  New test file needs new result file
mysql-test/suite/binlog/t/binlog_base64_flag.test:
  Added test case to verify that:
   - my patch fixes the bug
   - the new --base64-output flag works as expected
   - base64 events not preceded by an FD event give an error
   - an event of a type not known by the current FD event fails cleanly.
mysql-test/suite/binlog/std_data/binlog-bug32407.000001:
  BitKeeper file /home/sven/bk/b32407-5.1-new-rpl-mysqlbinlog_base64/mysql-test/suite/binlog/std_data/binlog-bug32407.000001
2007-12-14 19:02:02 +01:00
unknown
96a51b7f39 Bug#31552 Replication breaks when deleting rows from out-of-sync table
without PK
Bug#31609 Not all RBR slave errors reported as errors
bug#32468 delete rows event on a table with foreign key constraint fails

The first two bugs comprise idempotency issues.
First, there was no error code reported under conditions of the bug
description although the slave sql thread halted.
Second, executions were different with and without presence of prim key in
the table.
Third, there was no way to instruct the slave whether to ignore an error
and skip to the following event or to halt.
Fourth, there are handler errors which might happen due to idempotent
applying of binlog but those were not listed among the "idempotent" error
list.

All the named issues are addressed.
Wrt to the 3rd, there is the new global system variable, changeble at run
time, which controls the slave sql thread behaviour.
The new variable allows further extensions to mimic the sql_mode
session/global variable.
To address the 4th, the new bug#32468 had to be fixed as it was staying
in the way.


include/my_bitmap.h:
  basic operations with bits of an integer type are added.
mysql-test/extra/rpl_tests/rpl_foreign_key.test:
  regression test for bug#32468
mysql-test/extra/rpl_tests/rpl_row_basic.test:
  changes due to bug#31552/31609 idempotency is not default any longer
mysql-test/extra/rpl_tests/rpl_row_tabledefs.test:
  changes due to bug#31552/31609 idempotency is not default any longer
mysql-test/suite/rpl/r/rpl_foreign_key_innodb.result:
  results changed
mysql-test/suite/rpl/r/rpl_idempotency.result:
  results changed
mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result:
  results changed
mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result:
  results changed
mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result:
  results changed
mysql-test/suite/rpl/r/rpl_row_mystery22.result:
  results changed
mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result:
  results changed
mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result:
  results changed
mysql-test/suite/rpl/r/rpl_temporary_errors.result:
  results changed
mysql-test/suite/rpl/t/rpl_idempotency.test:
  extenstions to the test providing testing of complements to the
  idempotent error set and checking how slave halts when it faces an error
  from the list when the mode is STRICT.
mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test:
  changes due to bug#31552/31609 idempotency is not default any longer.
mysql-test/suite/rpl/t/rpl_row_mystery22.test:
  changes due to bug#31552/31609 idempotency is not default any longer
mysql-test/suite/rpl/t/rpl_temporary_errors.test:
  changes due to bug#31552/31609 idempotency is not default any longer
mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_advance.result:
  results changed
mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result:
  results changed
sql/log_event.cc:
  the fix for bug#32468 delete rows event on a table with foreign key constraint fails
  ensures the flags are set at proper time so that their values will be caught
  by innodb.
  reseting the flags is done along the common error and errorless execution
  path.
  The list of idempotent error is extended with foreign keys related items.
  NDB engine write events are designed with the replace sematics in mind.
  Therefore the corrsponding ndb handler's flag are (re)set regardless of
  the slave's execution mode.
  Rows_log_event::write_row() starts using the bool replace argument as its
  caller sets it depending on the event's execution mode.
sql/log_event.h:
  adding a new member to hold the slave's mode during execution of the event.
sql/mysql_priv.h:
  changes to link the command line option with the new global sys var.
sql/mysqld.cc:
  introduction of the new command line option.
  providing its initialization to a default.
  changes to link the command line option with the new global sys var.
sql/rpl_rli.cc:
  rli post-event-execution cleanup restores the default bits.
sql/set_var.cc:
  The new "standard" sys_var_set class' and the new global system var related
  declarations and definitions.
  fix_slave_exec_mode() is used as with the update method of a new class so
  as at time of the command line arguments parsing.
sql/set_var.h:
  new declarations. The class for the new global sys var is based on
  yet another new "standard" one.
sql/share/errmsg.txt:
  slave_exec_mode setting error;
  slave inconsistency error which may be not an error when the intention
  is "idempotent". I.e consisting of row-based events binlog is being
  applied for the 2nd (more) time.
sql/sql_class.h:
  The names for the bits of the new sever slave_exec_mode_options.
mysql-test/suite/rpl/t/rpl_idempotency-master.opt:
  innodb is necessary
mysql-test/suite/rpl/t/rpl_idempotency-slave.opt:
  innodb is necessary, as well as the tests start with non-default
  IDEMPOTENT slave execution mode.
2007-12-12 12:14:59 +02:00
unknown
200f0531ef Merge koti.dsl.inet.fi:/home/elkin/MySQL/TEAM/FIXES/5.0/bug27571_asyn_killed_flags
into  koti.dsl.inet.fi:/home/elkin/MySQL/5.1-merge-bug27571


client/mysql.cc:
  Auto merged
mysql-test/r/ctype_euckr.result:
  Auto merged
mysql-test/r/ctype_uca.result:
  Auto merged
mysql-test/suite/binlog/r/binlog_killed.result:
  Auto merged
mysql-test/suite/binlog/t/binlog_killed.test:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/log_event.cc:
  Auto merged
sql/log_event.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/sp_head.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
strings/ctype-euc_kr.c:
  Auto merged
mysql-test/suite/rpl/r/rpl_sp_effects.result:
  manual merge ul
mysql-test/suite/rpl/t/rpl_sp_effects.test:
  manual merge
sql/slave.cc:
  leaving for manual merge
sql/sql_delete.cc:
  leaving for manual merge
sql/sql_insert.cc:
  leaving for manual merge
sql/sql_load.cc:
  leaving for manual merge
sql/sql_update.cc:
  leaving for manual merge
2007-10-30 11:31:03 +02:00