timeout
In STMT and MIXED modes, a statement that changes both non-transactional and
transactional tables must be written to the binary log whenever there are
changes to non-transactional tables. This means that the statement gets into the
binary log even when the changes to the transactional tables fail. In particular
, in the presence of a failure such statement is annotated with the error number
and wrapped in a begin/rollback. On the slave, while applying the statement, it
is expected the same failure and the rollback prevents the transactional changes
to be persisted.
Unfortunately, statements that fail due to concurrency issues (e.g. deadlocks,
timeouts) are logged in the same way causing the slave to stop as the statements
are applied sequentially by the SQL Thread. To fix this bug, we automatically
ignore concurrency failures on the slave. Specifically, the following failures
are ignored: ER_LOCK_WAIT_TIMEOUT, ER_LOCK_DEADLOCK and ER_XA_RBDEADLOCK.
While reading a binary log that is being used by a master or was not properly
closed, most likely due to a crash, the following warning message is being
printed out: "Warning: this binlog was not closed properly. Most probably mysqld
crashed writing it.". This was scaring our users as the message was not taking
into account the possibility of the file is being just used by the master.
To avoid unnecessarily scaring our users, we replace the original message by the
following one: Warning: "this binlog is either is use or was not closed properly.".
with gcc 4.3.2
Compiling MySQL with gcc 4.3.2 and later produces a number of
warnings, many of which are new with the recent compiler
versions.
This bug will be resolved in more than one patch to limit the
size of changesets. This is the first patch, fixing a number
of the warnings, predominantly "suggest using parentheses
around && in ||", and empty for and while bodies.
with gcc 4.3.2
Compiling MySQL with gcc 4.3.2 and later produces a number of
warnings, many of which are new with the recent compiler
versions.
This bug will be resolved in more than one patch to limit the
size of changesets. This is the first patch, fixing a number
of the warnings, predominantly "suggest using parentheses
around && in ||", and empty for and while bodies.
BEGIN/COMMIT/ROLLBACK was subject to replication db rules, and
caused the boundary of a transaction not recognized correctly
when these queries were ignored by the rules.
Fixed the problem by skipping replication db rules for these
statements.
sql/log_event.cc:
Skip checking replication db rules for BEGIN/COMMIT/ROLLBACK statements
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
"freeing items"
The calculation of the table map log event in the event constructor
was one byte shorter than what would be actually written. This would
lead to a mismatch between the number of bytes written and the event
end_log_pos, causing bad event alignment in the binlog (corrupted
binlog) or in the transaction cache while fixing positions
(MYSQL_BIN_LOG::write_cache). This could lead to impossible to read
binlog or even infinite loops in MYSQL_BIN_LOG::write_cache.
This patch addresses this issue by correcting the expected event
length in the Table_map_log_event constructor, when the field metadata
size exceeds 255.
sql/log_event.cc:
Added the extra byte as net_store_length imposes.
In the output from mysqlbinlog, incident log events were
represented as just a comment. Since the incident log event
represents an incident that could cause the contents of the
database to change without being logged to the binary log,
it means that if the SQL is applied to a server, it could
potentially lead to that the databases are out of sync.
In order to handle that, this patch adds the statement "RELOAD
DATABASE" to the SQL output for the incident log event. This will
require a DBA to edit the file and handle the case as apropriate
before applying the output to a server.
mysql-test/suite/binlog/t/binlog_incident-master.opt:
Options file to cause server to generate an incident log
event when executing a REPLACE.
mysql-test/suite/binlog/t/binlog_incident.test:
Test to check that the incident log event is represented
correctly in the output from mysqlbinlog.
sql/log_event.cc:
The incident log event now ouput a "RELOAD DATABASE" instead
of just a comment. RELOAD DATABASE is not an existing command
and will generate a syntax error.
165 changesets with 23 conflicts:
Text conflict in mysql-test/r/lock_multi.result
Text conflict in mysql-test/t/lock_multi.test
Text conflict in mysql-test/t/mysqldump.test
Text conflict in sql/item_strfunc.cc
Text conflict in sql/log.cc
Text conflict in sql/log_event.cc
Text conflict in sql/parse_file.cc
Text conflict in sql/slave.cc
Text conflict in sql/sp.cc
Text conflict in sql/sp_head.cc
Text conflict in sql/sql_acl.cc
Text conflict in sql/sql_base.cc
Text conflict in sql/sql_class.cc
Text conflict in sql/sql_crypt.cc
Text conflict in sql/sql_db.cc
Text conflict in sql/sql_lex.cc
Text conflict in sql/sql_parse.cc
Text conflict in sql/sql_select.cc
Text conflict in sql/sql_table.cc
Text conflict in sql/sql_view.cc
Text conflict in storage/innobase/handler/ha_innodb.cc
Text conflict in storage/myisam/mi_packrec.c
Text conflict in tests/mysql_client_test.c
Updates to Innobase, taken from main 5.1:
bzr: ERROR: Some change isn't sane:
File mysql-test/r/innodb-semi-consistent.result is owned by Innobase and should not be updated.
File mysql-test/t/innodb-semi-consistent.test is owned by Innobase and should not be updated.
File storage/innobase/handler/ha_innodb.cc is owned by Innobase and should not be updated.
File storage/innobase/ibuf/ibuf0ibuf.c is owned by Innobase and should not be updated.
File storage/innobase/include/row0mysql.h is owned by Innobase and should not be updated.
File storage/innobase/include/srv0srv.h is owned by Innobase and should not be updated.
File storage/innobase/include/trx0trx.h is owned by Innobase and should not be updated.
File storage/innobase/include/trx0trx.ic is owned by Innobase and should not be updated.
File storage/innobase/lock/lock0lock.c is owned by Innobase and should not be updated.
File storage/innobase/page/page0cur.c is owned by Innobase and should not be updated.
File storage/innobase/row/row0mysql.c is owned by Innobase and should not be updated.
File storage/innobase/row/row0sel.c is owned by Innobase and should not be updated.
File storage/innobase/srv/srv0srv.c is owned by Innobase and should not be updated.
File storage/innobase/trx/trx0trx.c is owned by Innobase and should not be updated.
(Set env var 'ALLOW_UPDATE_INNOBASE_OWNED' to override.)
The rpl_binlog_corruption test case was inject failures, specifically,
incidents with invalid numbers to see if the replication was failing
gracefully. However, this test was causing the following warning message
in Valgrind: "Conditional jump or move depends on uninitialised value(s)"
The patch fixes the problem by correctly initializing the m_inicident
number.
Binlog the CREATE EVENT unless the created event been successfully dropped
Modified Query_log_event constructor to make sure that error_code
is not set to ER_SERVER_SHUTDOWN or ER_QUERY_INTERRUPTED errors
when NOT_KILLED
sql/events.cc:
binlog the create event unless it's been successfully dropped
sql/log_event.cc:
Modified Query_log_event constructor to make sure that error_code
is not set to ER_SERVER_SHUTDOWN or ER_QUERY_INTERRUPTED errors
when NOT_KILLED
RBR was not considering the option --slave-skip-errors.
To fix the problem, we are reporting the ignored ERROR(s) as warnings thus avoiding
stopping the SQL Thread. Besides, it fixes the output of "SHOW VARIABLES LIKE
'slave_skip_errors'" which was showing nothing when the value "all" was assigned
to --slave-skip-errors.
@sql/log_event.cc
skipped rbr errors when the option skip-slave-errors is set.
@sql/slave.cc
fixed the output of for SHOW VARIABLES LIKE 'slave_skip_errors'"
@test-cases
fixed the output of rpl.rpl_idempotency
updated the test case rpl_skip_error
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.
Bug#319 if while a non-transactional slave is replicating a transaction possible problem
It is impossible to roll back a mixed engines transaction when one of the engine is
non-transaction. In replication that fact is crucial because the slave can not safely
re-apply a transction that was interrupted with STOP SLAVE.
Fixed with making STOP SLAVE not be effective immediately in the case the current
group of replication events has modified a non-transaction table. In order for slave to leave
either the group needs finishing or the user issues KILL QUERY|CONNECTION slave_thread_id.
mysql-test/suite/bugs/r/rpl_bug38205.result:
bug#38205 non-deterministic part of tests results.
mysql-test/suite/bugs/t/rpl_bug38205.test:
bug#38205 non-deterministic part of tests.
mysql-test/suite/rpl/r/rpl_start_stop_slave.result:
bug#38205 deterministic part of tests results.
mysql-test/suite/rpl/t/rpl_start_stop_slave-slave.opt:
increasing `innodb_lock_wait_timeout' to make the test pass on slow env w/o
timeout expired issue.
mysql-test/suite/rpl/t/rpl_start_stop_slave.test:
bug#38205 deterministic part of tests.
sql/log_event.cc:
Augmenting row-based events applying with the notion of
thd->transaction.{all,stmt}.modified_non_trans_table.
The pair is set and reset according to its specification
for the mixed transaction processing.
Particualry, once `modified_non_trans_table' is set in the row-events
processing loop, it will remain till the commit of the transaction.
sql/slave.cc:
Consulting `thd->transaction.all.modified_non_trans_table' to decide
whether to terminate by the sql thread or to continue even though
the sql thread might have been STOP-ed (rli->abort_slave).
The issue happened to be two-fold.
The table map event was recorded into binlog having
an incorrect size when number of columns exceeded 251.
The Row-based event had incorrect recording and restoring m_width member within
the same as above conditions.
Fixed with correcting m_data_size and m_width.
mysql-test/suite/rpl/r/rpl_row_wide_table.result:
the new test results.
mysql-test/suite/rpl/t/rpl_row_wide_table.test:
regression test for bug#42977.
sql/log_event.cc:
0. all buffers that used in net_store_length() are augmented with 1 for safety
to be able to contain the magic and the content of ulonglong as well;
1. Rows_log_event::get_data_size() yieled incorrect size |m_width/8| whereas
it should be m_width;
2. Table_map_log_event::Table_map_log_event yieled incorrect value for
`m_data_size' probably presuming 1-byte integer max for the column number;
sql/rpl_utility.h:
DBUG_PRINT_BITSET() macro is left 256-cols limited but has made safe and commented.
Compiling with debug and assigning an invalid directory to --slave-load-tmpdir
was crashing the slave due to the following assertion DBUG_ASSERT(! is_set() ||
can_overwrite_status). This assertion assumes that a thread can change its
state once (i.e. ok,error, etc) before aborting, cleaning/resuming or completing
its execution unless the overwrite flag (i.e. can_overwrite_status) is true.
The Append_block_log_event::do_apply_event which is responsible for creating
temporary file(s) was not cleaning the thread state. Thus a failure while
trying to create a file in an invalid temporary directory was causing the crash.
To fix the problem we check if the temporary directory is valid before starting
the SQL Thread and reset the thread state before creating a file in
Append_block_log_event::do_apply_event.
The problem is issued because we set wrong start position and stop position of query string into binlog.
That two values are stored as part of head info of query string.
When we parse binlog, we first get position values then get the query string according position values.
But seems that two values are not calculated correctly after the parse of Yacc.
We don't want to touch so much of yacc because it may influence other codes.
So just add one space after 'INTO' key word when parsing.
This can easily resolve the problem.
mysql-test/suite/rpl/r/rpl_loaddatalocal.result:
Test result
mysql-test/suite/rpl/t/rpl_loaddatalocal.test:
Test case
sql/log_event.cc:
Add space after 'INTO'.
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.
Signed integer format specifier forced to print the binlog header with server_id
negative if the unsigned value sets the sign-bit ON.
Fixed with correcting the specifier to correspond to typeof(server_id) == ulong.
mysql-test/r/mysqlbinlog.result:
results changed.
mysql-test/t/mysqlbinlog.test:
displaying the expected unsignedly formatted server_id value, bug#37313.
sql/log_event.cc:
Format specifier is corrected to correspond to typeof(server_id).
- 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
- 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
The bug happened because filtering-out a STMT_END_F-flagged event so that
the transaction COMMIT finds traces of incomplete statement commit.
Such situation is only possible with ndb circular replication. The filtered-out
rows event is one that immediately preceeds the COMMIT query event.
Fixed with deploying an the rows-log-event statement commit at executing
of the transaction COMMIT event.
Resources that were allocated by other than STMT_END_F-flagged event of
the last statement are clean up prior execution of the commit logics.
mysql-test/suite/rpl_ndb/t/disabled.def:
re-enabling two tests.
sql/log_event.cc:
Adding the statement cleanup to execute at the transaction commit time.
The statement might not be ended with execution of STMT_END_F-flagged event because of
the event was filtered out by SERVER_ID rules.
Small refactoring for Rows_log_event::do_update_pos() to be split on two parts:
the statement commit that releases its execution time allocated resources, and
the relay log update.
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
It's a regression issue.
The reason of the bug appeared to be an error introduced into 5.1 source code.
A piece of code in Create_file_log_event::do_apply_event() did not have test
coverage which made make test and pb unaware.
Fixed with inverting the old value of the return value from
Create_file_log_event::do_apply_event().
The rpl test suite is extended with `rpl_cross_version' the file to hold
regression cases similar to the current.
mysql-test/suite/rpl/r/rpl_cross_version.result:
new results file
mysql-test/suite/rpl/t/rpl_cross_version-master.opt:
options to the server to be able to start replication to itself
mysql-test/suite/rpl/t/rpl_cross_version.test:
regression test for bug#31240.
sql/log_event.cc:
Correcting the return value from Create_file_log_event::do_apply_event()
The next number (AUTO_INCREMENT) field of the table for write
rows events are not initialized, and cause some engines (innodb)
not correctly update the tables's auto_increment value.
This patch fixed this problem by honor next number fields if present.
mysql-test/extra/rpl_tests/rpl_auto_increment.test:
Add test code for BUG#41986
mysql-test/suite/rpl/r/rpl_auto_increment.result:
update test result file for BUG#41986
sql/log_event.cc:
set next_number_field before writing rows, and reset next_number_field after finished writing rows
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.
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.
Related to operator precedence and associativity.
Make the expressions as explicit as possible.
sql/field.h:
Silence gcc-4.3 warning: be more explicit.
sql/item.cc:
Silence gcc-4.3 warning: be more explicit.
sql/item_sum.cc:
Silence gcc-4.3 warning: be more explicit.
sql/log_event.cc:
Silence gcc-4.3 warning: be more explicit.
sql/spatial.h:
Silence gcc-4.3 warning: be more explicit.
sql/sql_lex.cc:
Silence gcc-4.3 warning: be more explicit.
sql/table.h:
Silence gcc-4.3 warning: be more explicit.
storage/federated/ha_federated.cc:
Fix operator precedence bug.
storage/heap/ha_heap.cc:
Silence gcc-4.3 warning: be more explicit.
In certain situations, a scan of the table will return the error
code HA_ERR_RECORD_DELETED, and this error code is not
correctly caught in the Rows_log_event::find_row() function, which
causes an error to be returned for this case.
This patch fixes the problem by adding code to either ignore the
record and continuing with the next one, the the event of a table
scan, or change the error code to HA_ERR_KEY_NOT_FOUND, in the event
that a key lookup is attempted.
ha_statistic_increment for rpl_temporary
Problem: in some cases master send a special event to reconnecting
slave to keep slave's temporary tables (see #17284) and they still
have references to the "old" SQL slave thread and use them to access
thread's data.
Fix: set temporary tables thread references to the actual SQL slave
thread in such cases.
mysql-test/suite/rpl/t/disabled.def:
Fix for bug#38269: pushbuild gives valgrind error in
ha_statistic_increment for rpl_temporary
- rpl_temporary test enabled.
sql/log_event.cc:
Fix for bug#38269: pushbuild gives valgrind error in
ha_statistic_increment for rpl_temporary
- if we keep slave's temporary tables after reconnect,
set their thread pointers (->in_use) to the current SQL thread.
The Blackhole engine did not support row-based replication
since the delete_row(), update_row(), and the index and range
searching functions were not implemented.
This patch adds row-based replication support for the
Blackhole engine by implementing the two functions mentioned
above, and making the engine pretend that it has found the
correct row to delete or update when executed from the slave
SQL thread by implementing index and range searching functions.
It is necessary to only pretend this for the SQL thread, since
a SELECT executed on the Blackhole engine will otherwise never
return EOF, causing a livelock.
mysql-test/extra/binlog_tests/blackhole.test:
Blackhole now handles row-based replication.
mysql-test/extra/rpl_tests/rpl_blackhole.test:
Test helper file for testing that blackhole actually
writes something to the binary log on the slave.
mysql-test/suite/binlog/t/binlog_multi_engine.test:
Replication now handles row-based replcation.
mysql-test/suite/rpl/t/rpl_blackhole.test:
Test that Blackhole works with primary key, index, or none.
sql/log_event.cc:
Correcting code to only touch filler bits and leave
all other bits alone. It is necessary since there is
no guarantee that the engine will be able to fill in
the bits correctly (e.g., the blackhole engine).
storage/blackhole/ha_blackhole.cc:
Adding definitions for update_row() and delete_row() to return OK
when executed from the slave SQL thread with thd->query == NULL
(indicating that row-based replication events are being processed).
Changing rnd_next(), index_read(), index_read_idx(), and
index_read_last() to return OK when executed from the slave SQL
thread (faking that the row has been found so that processing
proceeds to update/delete the row).
storage/blackhole/ha_blackhole.h:
Enabling row capabilities for engine.
Defining write_row(), update_row(), and delete_row().
Making write_row() private (as it should be).
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
In order to improve the performance when replicating to partitioned
myisam tables with row-based format, the number of rows of current
rows log event is estimated and used to setup storage engine for bulk
inserts.
The replication filtering rules were inappropiately applied when
executing BINLOG pseudo-query. The rules are supposed to be active
only at times when the slave's sql thread executes an event.
Fixed with correcting a condition to call replication rules only if
the slave sql thread executes the event.
mysql-test/suite/rpl/r/rpl_binlog_query_filter_rules.result:
new result file
mysql-test/suite/rpl/t/rpl_binlog_query_filter_rules-master.opt:
a filtering option that would refuse to replicate a row event of the main test on
slave
mysql-test/suite/rpl/t/rpl_binlog_query_filter_rules.test:
a regression test for the bug
sql/log_event.cc:
avoiding to call the filtering rules if the execution thread is not a slave.
- 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.
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
manually resolved conflicts:
Text conflict in client/mysqltest.c
Contents conflict in mysql-test/include/have_bug25714.inc
Text conflict in mysql-test/include/have_ndbapi_examples.inc
Text conflict in mysql-test/mysql-test-run.pl
Text conflict in mysql-test/suite/parts/inc/partition_check_drop.inc
Text conflict in mysql-test/suite/parts/inc/partition_layout.inc
Text conflict in mysql-test/suite/parts/inc/partition_layout_check1.inc
Text conflict in mysql-test/suite/parts/inc/partition_layout_check2.inc
Text conflict in mysql-test/suite/parts/r/partition_alter1_1_2_myisam.result
Text conflict in mysql-test/suite/parts/r/partition_alter1_1_myisam.result
Text conflict in mysql-test/suite/parts/r/partition_alter1_2_myisam.result
Text conflict in mysql-test/suite/parts/r/partition_alter2_myisam.result
Text conflict in mysql-test/suite/parts/r/partition_alter3_innodb.result
Text conflict in mysql-test/suite/parts/r/partition_alter3_myisam.result
Text conflict in mysql-test/suite/parts/r/partition_basic_innodb.result
Text conflict in mysql-test/suite/parts/r/partition_basic_myisam.result
Text conflict in mysql-test/suite/parts/r/partition_basic_symlink_myisam.result
Text conflict in mysql-test/suite/parts/r/partition_engine_myisam.result
Text conflict in mysql-test/suite/parts/r/partition_syntax_myisam.result
Text conflict in mysql-test/suite/rpl_ndb/t/disabled.def
Text conflict in mysql-test/t/disabled.def
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
On certain kinds of errors (e.g., out of stack), a call to Item_func_
set_user_var::fix_fields() might fail. Since the return value of this
call was not checked inside User_var_log_event::exec_event(), continuing
execution after this will cause a crash inside Item_func_set_user_var::
update_hash().
The bug is fixed by aborting execution of the event with an error if
fix_fields() fails, since it is not possible to continue execution anyway.
sql/log_event.cc:
Aborting execution of event if fix_fields() fails since execution
of update_hash() might cause a crash.
When flushing tables, there were a slight chance that the flush was occuring
between processing of two table map events. Since the tables are opened
one by one, it might result in that the tables were not valid and that sub-
sequent locking of tables would cause the slave to crash.
The problem is solved by opening and locking all tables at once using
simple_open_n_lock_tables(). Also, the patch contain a change to open_tables()
so that pre-locking only takes place when the trg_event_map is not zero, which
was not the case before (this caused the lock to be placed in thd->locked_tables
instead of thd->lock since the assumption was that triggers would be called
later and therefore the tables should be pre-locked).
mysql-test/suite/rpl/r/rpl_found_rows.result:
Result change
mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result:
Result change
mysql-test/suite/rpl/t/rpl_found_rows.test:
Adding drop of table that was created in test.
mysql-test/suite/rpl/t/rpl_slave_status.test:
Adding waits for slave start and stop to ensure that test works.
sql/log_event.cc:
Replacing table-by-table open and lock with a single call
to simple_open_n_lock_tables(), which in turn required some
changes to other code.
sql/log_event_old.cc:
Replacing table-by-table open and lock with a single call
to simple_open_n_lock_tables(), which in turn required some
changes to other code.
sql/sql_base.cc:
Extending check inside open_tables() so that pre-locking in only done if
tables->trg_egent_map is non-zero.
mysql-test/include/wait_for_slave_sql_to_start.inc:
New BitKeeper file ``mysql-test/include/wait_for_slave_sql_to_start.inc''
into dl145h.mysql.com:/data0/mkindahl/mysql-5.1-rpl-merge
mysql-test/suite/binlog/r/binlog_base64_flag.result:
Auto merged
mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result:
Auto merged
sql/log_event.cc:
Auto merged
Problem: a typo in the code. When autocommit, foreign_key_checks,
sql_auto_is_null, or unique_checks changes, it prints "SET", and then a
comma-separated list of assignments. However, it does not print the
assignment to the @@autocommit variable.
Fix: print the @@autocommit variable.
mysql-test/r/mysqlbinlog.result:
Updated result file since output of mysqlbinlog changed.
mysql-test/r/mysqlbinlog2.result:
Updated result file since output of mysqlbinlog changed.
mysql-test/r/user_var-binlog.result:
Updated result file since output of mysqlbinlog changed.
mysql-test/suite/binlog/r/binlog_base64_flag.result:
Updated result file since output of mysqlbinlog changed.
mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result:
Updated result file since output of mysqlbinlog changed.
mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result:
Updated result file since output of mysqlbinlog changed.
sql/log_event.cc:
Just a typo: mysqlbinlog should print the autocommit flag
when the value of the flag changes.
Also fixed nearby indentation.
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
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.
into stella.local:/home2/mydev/mysql-5.1-axmrg
mysql-test/r/ctype_big5.result:
Auto merged
mysql-test/r/ctype_euckr.result:
Auto merged
mysql-test/r/ctype_gb2312.result:
Auto merged
mysql-test/r/ctype_gbk.result:
Auto merged
mysql-test/r/ctype_uca.result:
Auto merged
mysql-test/r/ctype_ucs.result:
Auto merged
mysql-test/suite/binlog/r/binlog_row_ctype_cp932.result:
Auto merged
mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result:
Auto merged
mysql-test/t/ctype_ucs.test:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/log.cc:
Auto merged
sql/log_event.cc:
Auto merged
sql/rpl_rli.cc:
Auto merged
sql/slave.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
mysql-test/lib/mtr_report.pl:
SCCS merged
into pcg5ppc.xiphis.org:/Network/Servers/anubis.xiphis.org/home/antony/work/merge.20080307/mysql-5.1
configure.in:
Auto merged
include/mysql/plugin.h:
Auto merged
mysql-test/r/information_schema.result:
Auto merged
mysql-test/r/partition_innodb.result:
Auto merged
mysql-test/t/information_schema.test:
Auto merged
mysql-test/t/partition_innodb.test:
Auto merged
sql/item.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/log.cc:
Auto merged
sql/log_event.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/repl_failsafe.cc:
Auto merged
sql/slave.cc:
Auto merged
sql/slave.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_partition.cc:
Auto merged
sql/sql_plugin.cc:
Auto merged
sql/sql_show.cc:
Auto merged
sql/sql_table.cc:
Auto merged
storage/myisam/mi_dynrec.c:
Auto merged
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).
There was a failure in that show slave status displayed a wrong message
when slave stopped at processing a row event inserting to a default-less
column.
The problem seem to have ceased after recent fixes in rbr code.
However, the test was not updated to carry testing of the case commented-out.
Uncommenting and editing the test.
Notice, Bug#23907 is most probably a duplicate of this one.
mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test:
uncommenting the test that previously failed.
mysql-test/suite/rpl/r/rpl_extraCol_innodb.result:
results changed due to the correct expected error message of an added test
is displayed.
mysql-test/suite/rpl/r/rpl_extraCol_myisam.result:
results changed to reflect the test changes
mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result:
results changed to reflect the uncommented test
sql/log_event.cc:
correcting of a merge with bug#12713 to use the correct object holding
the error code.
Rename client_last_error to last_error and client_last_errno to last_errno
to not break connectors which use the internal net structure for error handling.
include/mysql_com.h:
Rename client_last_error to last_error, client_last_errno to last_errno.
include/mysql_h.ic:
Rename client_last_error to last_error, client_last_errno to last_errno.
libmysql/libmysql.c:
Rename client_last_error to last_error, client_last_errno to last_errno.
libmysql/manager.c:
Rename client_last_error to last_error, client_last_errno to last_errno.
libmysqld/lib_sql.cc:
Rename client_last_error to last_error, client_last_errno to last_errno.
libmysqld/libmysqld.c:
Rename client_last_error to last_error, client_last_errno to last_errno.
server-tools/instance-manager/mysql_connection.cc:
Rename client_last_error to last_error, client_last_errno to last_errno.
sql/log_event.cc:
Rename client_last_error to last_error, client_last_errno to last_errno.
sql-common/client.c:
Rename client_last_error to last_error, client_last_errno to last_errno.
sql/log_event_old.cc:
Rename client_last_error to last_error, client_last_errno to last_errno.
sql/net_serv.cc:
Rename client_last_error to last_error, client_last_errno to last_errno.
sql/repl_failsafe.cc:
Rename client_last_error to last_error, client_last_errno to last_errno.
into mysql.com:/home/svoj/devel/mysql/BUG13861/mysql-5.1-engines
mysql-test/suite/rpl/r/rpl_dual_pos_advance.result:
Auto merged
sql/log_event.cc:
Auto merged
sql/slave.h:
Use local.
mysql-test/suite/rpl/t/rpl_dual_pos_advance.test:
Manual merge.
sql/slave.cc:
Manual merge.