Commit graph

165 commits

Author SHA1 Message Date
Sergei Golubchik
7002291b8a Merge branch '10.0' into 10.1 2017-11-10 01:14:58 +01:00
Sergei Golubchik
56394a78e3 MDEV-12372 mysqlbinlog --version output is the same on 10.x as on 5.5.x, and contains not only version
don't print usage() for --version
2017-11-09 21:43:52 +01:00
Monty
3a3ec744b5 cleanups done as part of adding encryption
- Fixed compiler warnings
- Added include/wait_for_binlog_checkpoint.inc, as suggested by JonasO
- Updated 'build-tags' to work with git (Patch by Serg)
2015-02-10 10:21:16 +01:00
Sergei Golubchik
7f5e51b940 MDEV-34 delete storage/ndb and sql/*ndb* (and collateral changes)
remove:
* NDB from everywhere
* IM from mtr-v1
* packaging/rpm-oel and packaging/rpm-uln
* few unused spec files
* plug.in file
* .bzrignore
2014-10-11 18:53:06 +02:00
Sergei Golubchik
1989ae9e10 fix TZ setting to be Windows-compatible 2013-09-25 19:41:41 +02:00
Sergei Golubchik
4ec2e9d7ed 5.5 merge and fixes for compiler/test errors 2013-09-18 13:07:31 +02:00
unknown
7a80c534ad MDEV-4645: Incorrect reads of frozen binlog events; FDE corrupted in relay log
Currently several places use description_event->common_header_len instead of
  LOG_EVENT_MINIMAL_HEADER_LEN when parsing events with "frozen" headers (such
  as Start_event_v3 and its subclasses such as Format_description_log_event, as
  well as Rotate_event). This causes events with extra headers (which would otherwise
  be valid and those headers ignored) to be corrupted due to over-reading or skipping
  into the data portion of the log events.
  
  It is rewritten in some details patch of Jeremy Cole (See MDEV):
  - The virtual function returns length to avoid IFs (and only one call of the virtual function made)
  - Printing function avoids printing strings
2013-09-12 21:36:58 +03:00
unknown
d9f975d08b MDEV-26: Global transaction ID
Adjust full test suite to work with GTID.

Huge patch, mainly due to having to update .result file for all SHOW BINLOG
EVENTS and mysqlbinlog outputs, where the new GTID events pop up.

Everything was painstakingly checked to be still correct and valid .result
file updates.
2013-03-26 10:35:34 +01:00
Sergei Golubchik
76f0b94bb0 merge with 5.3
sql/sql_insert.cc:
  CREATE ... IF NOT EXISTS may do nothing, but
  it is still not a failure. don't forget to my_ok it.
  ******
  CREATE ... IF NOT EXISTS may do nothing, but
  it is still not a failure. don't forget to my_ok it.
sql/sql_table.cc:
  small cleanup
  ******
  small cleanup
2011-10-19 21:45:18 +02:00
Michael Widenius
f34be18938 Merge with MariaDB 5.2 2011-05-10 18:17:43 +03:00
unknown
c677fea7d0 Merge MariaDB 5.2.5 release into MariaDB-5.2-rpl. 2011-04-01 15:07:10 +02:00
Sven Sandberg
0907c91314 Merged BUG#11766427, BUG#59539 from 5.1 to 5.5.
No conflicts.
2011-03-25 15:35:45 +01:00
Sven Sandberg
f1b638d33c BUG#11766427, BUG#59539: Filter by server id in mysqlbinlog fails
Problem: mysqlbinlog --server-id may filter out Format_description_log_events.
If mysqlbinlog does not process the Format_description_log_event,
then mysqlbinlog cannot read the rest of the binary log correctly.
This can have the effect that mysqlbinlog crashes, generates an error,
or generates output that causes mysqld to crash, generate an error,
or corrupt data.
Fix: Never filter out Format_description_log_events. Also, never filter
out Rotate_log_events.


client/mysqlbinlog.cc:
  Process Format_description_log_events even when the
  server_id does not match the number given by --server-id.
mysql-test/t/mysqlbinlog.test:
  Add test case.
2011-03-25 15:16:13 +01:00
unknown
32379aeba9 Merge Percona patch MWL#47 into mariadb 5.2-percona.
This patch adds options to annotate the binlog (and the mysqlbinlog
output) with the original SQL query for queries that are logged
using row-based replication.
2011-01-10 14:53:09 +01:00
unknown
7f6ce96df7 Bug #50914 mysqlbinlog not handling drop of current default database
mysqlbinlog only prints "use $database" statements to its output stream
when the active default database changes between events. This will cause
"No Database Selected" error when dropping and recreating that database.
      
To fix the problem, we clear print_event_info->db when printing an event
of CREATE/DROP/ALTER database statements, so that the Query_log_event
after such statements will be printed with the use 'db' anyway except
transaction keywords.


mysql-test/r/mysqlbinlog.result:
  Test result for Bug#50914.
mysql-test/t/mysqlbinlog.test:
  Added test to verify if the approach of the mysqlbinlog prints
  "use $database" statements to its output stream will cause
  "No Database Selected" error when dropping and recreating
  that database.
sql/log_event.cc:
  Updated code to clear print_event_info->db when printing an event
  of CREATE/DROP/ALTER database statements, so that the Query_log_event
  after such statements will be printed with the use 'db' anyway except
  transaction keywords.
2010-12-29 13:22:52 +08:00
unknown
22639a066c Bug #50914 mysqlbinlog not handling drop of current default database
mysqlbinlog only prints "use $database" statements to its output stream
when the active default database changes between events. This will cause
"No Database Selected" error when dropping and recreating that database.

To fix the problem, we clear print_event_info->db when printing an event
of CREATE/DROP/ALTER database statements, so that the Query_log_event
after such statements will be printed with the use 'db' anyway except
transaction keywords.

mysql-test/r/mysqlbinlog.result:
  Test result for Bug#50914.
mysql-test/t/mysqlbinlog.test:
  Added test to verify if the approach of the mysqlbinlog prints
  "use $database" statements to its output stream will cause
  "No Database Selected" error when dropping and recreating
  that database.
sql/log_event.cc:
  Updated code to clear print_event_info->db when printing an event
  of CREATE/DROP/ALTER database statements, so that the Query_log_event
  after such statements will be printed with the use 'db' anyway except
  transaction keywords.
2010-12-29 11:52:57 +08:00
Sven Sandberg
c4a4119829 wL#5625: Deprecate mysqlbinlog options --base64-output=always and --base64-output
Adds deprecation warning for the mysqlbinlog options
--base64-output=always and --base64-output.
A warning is printed when the flags are used,
and also when running mysqlbinlog --help.


client/mysqlbinlog.cc:
  Give a warning for --base64-output=always and --base64-output,
  and print warning in mysqlbinlog --help.
mysql-test/r/mysqlbinlog.result:
  updated result file
mysql-test/t/mysqlbinlog.test:
  Test that mysqlbinlog --base64-output=always gives a warning.
2010-10-29 16:56:58 +02:00
unknown
0f935030c6 Bug #34283 mysqlbinlog leaves tmpfile after termination if binlog contains load data infile
Post fix

mysql-test/t/mysqlbinlog.test:
  Updated for Bug#34283
2010-08-03 18:36:09 +08:00
unknown
60ab046abc Bug #34283 mysqlbinlog leaves tmpfile after termination if binlog contains load data infile
Post fix

mysql-test/t/mysqlbinlog.test:
  Updated for Bug#34283
2010-08-03 18:27:45 +08:00
Andrei Elkin
b283ffcd53 merging for bug#54935 to trunk-bugfixing 2010-07-17 14:07:36 +03:00
Andrei Elkin
30e2c6f19b bug#54935
applying bundle made for next-mr-bugfixing to trunk-bugfixing branch of the bug
2010-07-16 21:25:00 +03:00
Alexander Nozdrin
762b535de2 Manual merge from mysql-trunk.
Conflicts:
  - mysql-test/suite/engines/funcs/t/disabled.def
  - mysql-test/suite/engines/iuds/t/disabled.def
  - mysql-test/suite/engines/iuds/t/insert_number.test
2010-05-07 13:37:16 +04:00
Sven Sandberg
cf5ebc5821 BUG#50670: Slave stops with error code 1644
Clarified error messages related to unsafe statements:
 - avoid the internal technical term "row injection"
 - use 'binary log' instead of 'binlog'
 - avoid the word 'unsafeness'


mysql-test/extra/binlog_tests/blackhole.test:
  updated suppression pattern
mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test:
  updated suppression pattern
mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test:
  updated suppression pattern
mysql-test/extra/rpl_tests/rpl_insert_id.test:
  updated suppression pattern
mysql-test/extra/rpl_tests/rpl_loaddata.test:
  updated suppression pattern
mysql-test/extra/rpl_tests/rpl_mixing_engines.test:
  updated suppression pattern
mysql-test/extra/rpl_tests/rpl_start_stop_slave.test:
  updated suppression pattern
mysql-test/extra/rpl_tests/rpl_stm_000001.test:
  updated suppression pattern
mysql-test/extra/rpl_tests/rpl_stop_middle_group.test:
  updated suppression pattern
mysql-test/r/archive.result:
  updated result file
mysql-test/r/commit_1innodb.result:
  updated result file
mysql-test/r/ctype_cp932_binlog_stm.result:
  updated result file
mysql-test/r/partition_innodb_stmt.result:
  updated result file
mysql-test/suite/binlog/r/binlog_innodb.result:
  updated result file
mysql-test/suite/binlog/r/binlog_killed.result:
  updated result file
mysql-test/suite/binlog/r/binlog_multi_engine.result:
  updated result file
mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result:
  updated result file
mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result:
  updated result file
mysql-test/suite/binlog/r/binlog_stm_blackhole.result:
  updated result file
mysql-test/suite/binlog/r/binlog_stm_do_db.result:
  updated result file
mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result:
  updated result file
mysql-test/suite/binlog/r/binlog_stm_ps.result:
  updated result file
mysql-test/suite/binlog/r/binlog_stm_row.result:
  updated result file
mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result:
  updated result file
mysql-test/suite/binlog/r/binlog_unsafe.result:
  updated result file
mysql-test/suite/binlog/t/binlog_killed.test:
  updated suppression pattern
mysql-test/suite/binlog/t/binlog_multi_engine.test:
  updated suppression pattern
mysql-test/suite/binlog/t/binlog_statement_insert_delayed.test:
  updated suppression pattern
mysql-test/suite/binlog/t/binlog_stm_ps.test:
  updated suppression pattern
mysql-test/suite/binlog/t/binlog_stm_row.test:
  updated suppression pattern
mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test:
  updated suppression pattern
mysql-test/suite/binlog/t/binlog_tmp_table.test:
  updated suppression pattern
mysql-test/suite/binlog/t/binlog_unsafe.test:
  updated suppression pattern
mysql-test/suite/ndb/r/ndb_binlog_format.result:
  updated result file
mysql-test/suite/ndb/t/ndb_binlog_format.test:
  updated suppression pattern
mysql-test/suite/perfschema/r/binlog_stmt.result:
  updated result file
mysql-test/suite/perfschema/t/binlog_stmt.test:
  updated suppression pattern
mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result:
  updated result file
mysql-test/suite/rpl/r/rpl_blackhole.result:
  updated result file
mysql-test/suite/rpl/r/rpl_concurrency_error.result:
  updated result file
mysql-test/suite/rpl/r/rpl_get_lock.result:
  updated result file
mysql-test/suite/rpl/r/rpl_insert_id.result:
  updated result file
mysql-test/suite/rpl/r/rpl_insert_ignore.result:
  updated result file
mysql-test/suite/rpl/r/rpl_misc_functions.result:
  updated result file
mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result:
  updated result file
mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result:
  updated result file
mysql-test/suite/rpl/r/rpl_mysql_upgrade.result:
  updated result file
mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result:
  updated result file
mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result:
  updated result file
mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result:
  updated result file
mysql-test/suite/rpl/r/rpl_nondeterministic_functions.result:
  updated result file
mysql-test/suite/rpl/r/rpl_read_only.result:
  updated result file
mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result:
  updated result file
mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result:
  updated result file
mysql-test/suite/rpl/r/rpl_row_mixing_engines.result:
  updated result file
mysql-test/suite/rpl/r/rpl_slow_query_log.result:
  updated result file
mysql-test/suite/rpl/r/rpl_sp.result:
  updated result file
mysql-test/suite/rpl/r/rpl_stm_000001.result:
  updated result file
mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result:
  updated result file
mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result:
  updated result file
mysql-test/suite/rpl/r/rpl_stm_loadfile.result:
  updated result file
mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result:
  updated result file
mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result:
  updated result file
mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result:
  updated result file
mysql-test/suite/rpl/r/rpl_temp_temporary.result:
  updated result file
mysql-test/suite/rpl/r/rpl_variables_stm.result:
  updated result file
mysql-test/suite/rpl/t/rpl000013.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_blackhole.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_concurrency_error.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_err_ignoredtable.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_get_lock.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_insert.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_insert_id.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_insert_ignore.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_invoked_features.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_misc_functions.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_mixed_bit_pk.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_mysql_upgrade.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_nondeterministic_functions.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_optimize.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_read_only.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_semi_sync.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_semi_sync_event.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_session_var.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_slow_query_log.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_sp.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_stm_auto_increment_bug33029.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_stm_found_rows.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_stm_insert_delayed.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_stm_loadfile.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_temp_table.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_temp_temporary.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_temporary.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_timezone.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_trigger.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_udf.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_user_variables.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_variables_stm.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_view_multi.test:
  updated suppression pattern
mysql-test/suite/rpl_ndb/r/rpl_ndb_binlog_format_errors.result:
  updated result file
mysql-test/suite/rpl_ndb/t/rpl_ndb_binlog_format_errors.test:
  updated suppression pattern
mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb.test:
  updated suppression pattern
mysql-test/suite/sys_vars/t/rpl_init_slave_func.test:
  updated suppression pattern
mysql-test/t/archive.test:
  updated suppression pattern
mysql-test/t/commit_1innodb.test:
  updated suppression pattern
mysql-test/t/create_select_tmp.test:
  updated suppression pattern
mysql-test/t/ctype_cp932_binlog_stm.test:
  updated suppression pattern
mysql-test/t/lock_sync.test:
  updated suppression pattern
mysql-test/t/mysqlbinlog.test:
  updated suppression pattern
mysql-test/t/mysqldump.test:
  updated suppression pattern
mysql-test/t/sp_trans.test:
  updated suppression pattern
sql/log_event.cc:
  Clarified error message.
sql/share/errmsg-utf8.txt:
  Clarified error messages.
2010-04-28 14:47:49 +02:00
Alexander Nozdrin
e642701c32 Manual merge from mysql-trunk.
Conflicts:
  - mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result
2010-04-27 13:58:21 +04:00
Alfranio Correia
dbf7c215ce BUG#51894 Replication failure with SBR on DROP TEMPORARY TABLE inside a
transaction
BUG#52616 Temp table prevents switch binlog format from STATEMENT to ROW

Post-merge fixes.


mysql-test/include/commit.inc:
  Changed the test case as drop temporary is now written to the binary log in row mode.
mysql-test/r/commit_1innodb.result:
  Changed the test case as drop temporary is now written to the binary log in row mode.
mysql-test/r/ctype_cp932_binlog_stm.result:
  Disabled warning messages because the test runs in both statement and mixed modes.
mysql-test/t/ctype_cp932_binlog_stm.test:
  Disabled warning messages because the test runs in both statement and mixed modes.
mysql-test/t/mysqlbinlog.test:
  Removed the --short-form due to BUG#18337 what was suppressing the
  select * from t5 /* must be (1),(1) */ in row format.
2010-04-21 14:28:00 +01:00
Alfranio Correia
20f5c421e7 BUG#51894 Replication failure with SBR on DROP TEMPORARY TABLE inside a
transaction
BUG#52616 Temp table prevents switch binlog format from STATEMENT to ROW

Before the WL#2687 and BUG#46364, every non-transactional change that happened
after a transactional change was written to trx-cache and flushed upon
committing the transaction. WL#2687 and BUG#46364 changed this behavior and
non-transactional changes are now written to the binary log upon committing
the statement.

A binary log event is identified as transactional or non-transactional through
a flag in the Log_event which is set taking into account the underlie storage
engine on what it is stems from. In the current bug, this flag was not being
set properly when the DROP TEMPORARY TABLE was executed.

However, while fixing this bug we figured out that changes to temporary tables
should be always written to the trx-cache if there is an on-going transaction.
Otherwise, binlog events in the reversed order would be produced.

Regarding concurrency, keeping changes to temporary tables in the trx-cache is
also safe as temporary tables are only visible to the owner connection.

In this patch, we classify the following statements as unsafe:
   1 - INSERT INTO t_myisam SELECT * FROM t_myisam_temp

   2 - INSERT INTO t_myisam_temp SELECT * FROM t_myisam

   3 - CREATE TEMPORARY TABLE t_myisam_temp SELECT * FROM t_myisam

On the other hand, the following statements are classified as safe:

   1 - INSERT INTO t_innodb SELECT * FROM t_myisam_temp

   2 - INSERT INTO t_myisam_temp SELECT * FROM t_innodb

The patch also guarantees that transactions that have a DROP TEMPORARY are
always written to the binary log regardless of the mode and the outcome:
commit or rollback. In particular, the DROP TEMPORARY is extended with the
IF EXISTS clause when the current statement logging format is set to row.

Finally, the patch allows to switch from STATEMENT to MIXED/ROW when there
are temporary tables but the contrary is not possible.

mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test:
  Updated the test case because 
     CREATE TEMPORARY TABLE t_innodb_temp SELECT * FROM t_myisam is not unsafe.
mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test:
  Updated the test case due to the new rules: changes to
  temporary tables are written to the binary log in the
  boundaries of a transaction if there is any.
mysql-test/extra/rpl_tests/rpl_innodb.test:
  Removed comments from the test case that became false after the patch.
mysql-test/extra/rpl_tests/rpl_loaddata.test:
  Suppressed warning messages due to the following cases:
  
     1 - INSERT INTO t_myisam SELECT * FROM t_myisam_temp
  
     2 - INSERT INTO t_myisam_temp SELECT * FROM t_myisam
mysql-test/include/ctype_utf8_table.inc:
  Suppressed warning messages due to the following cases:
  
     1 - INSERT INTO t_myisam SELECT * FROM t_myisam_temp
  
     2 - INSERT INTO t_myisam_temp SELECT * FROM t_myisam
mysql-test/r/ctype_cp932_binlog_stm.result:
  Updated the test case due to the new rules: changes to
  temporary tables are written to the binary log in the
  boundaries of a transaction if there is any.
mysql-test/suite/binlog/r/binlog_database.result:
  Updated the test case due to the new rules: changes to
  temporary tables are written to the binary log in the
  boundaries of a transaction if there is any.
mysql-test/suite/binlog/r/binlog_innodb_row.result:
  Updated the result file.
mysql-test/suite/binlog/r/binlog_multi_engine.result:
  Updated the unsafe message.
mysql-test/suite/binlog/r/binlog_row_binlog.result:
  Updated the test case due to the new rules: changes to
  temporary tables are written to the binary log in the
  boundaries of a transaction if there is any.
mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result:
  Updated the test case due to the new rules: changes to
  temporary tables are written to the binary log in the
  boundaries of a transaction if there is any.
mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result:
  Updated the test case due to the new rules: changes to
  temporary tables are written to the binary log in the
  boundaries of a transaction if there is any.
mysql-test/suite/binlog/r/binlog_stm_binlog.result:
  Updated the result file.
mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result:
  Updated the test case due to the new rules: changes to
  temporary tables are written to the binary log in the
  boundaries of a transaction if there is any.
mysql-test/suite/binlog/t/binlog_tmp_table.test:
  Suppressed warning messages due to the following cases:
  
     1 - INSERT INTO t_myisam SELECT * FROM t_myisam_temp
  
     2 - INSERT INTO t_myisam_temp SELECT * FROM t_myisam
mysql-test/suite/ndb/r/ndb_binlog_format.result:
  Updated the unsafe message.
mysql-test/suite/rpl/r/rpl_concurrency_error.result:
  Updated the unsafe message.
mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result:
  Updated the result file because 
     CREATE TEMPORARY TABLE t_innodb_temp SELECT * FROM t_myisam is not unsafe.
mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result:
  Updated the test case due to the new rules: changes to
  temporary tables are written to the binary log in the
  boundaries of a transaction if there is any.
mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result:
  Updated the test case due to the new rules: changes to
  temporary tables are written to the binary log in the
  boundaries of a transaction if there is any.
mysql-test/suite/rpl/r/rpl_mixed_row_innodb.result:
  Added some comments to ease the understanding of the result file.
mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result:
  Updated the test case due to the new rules: changes to
  temporary tables are written to the binary log in the
  boundaries of a transaction if there is any.
mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result:
  Updated the test case due to the new rules: changes to
  temporary tables are written to the binary log in the
  boundaries of a transaction if there is any.
mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result:
  Updated the test case due to the new rules: changes to
  temporary tables are written to the binary log in the
  boundaries of a transaction if there is any.
mysql-test/suite/rpl/r/rpl_row_drop.result:
  Updated the test case due to the new rules: changes to
  temporary tables are written to the binary log in the
  boundaries of a transaction if there is any.
mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result:
  Updated the test case due to the new rules: changes to
  temporary tables are written to the binary log in the
  boundaries of a transaction if there is any.
mysql-test/suite/rpl/r/rpl_row_mixing_engines.result:
  Updated the test case due to the new rules: changes to
  temporary tables are written to the binary log in the
  boundaries of a transaction if there is any.
mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result:
  Updated the result file because 
     CREATE TEMPORARY TABLE t_innodb_temp SELECT * FROM t_myisam is not unsafe.
mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result:
  Updated the test case due to the new rules: changes to
  temporary tables are written to the binary log in the
  boundaries of a transaction if there is any.
mysql-test/suite/rpl/r/rpl_stm_innodb.result:
  Added some comments to ease the understanding of the result file.
mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result:
  Updated the test case due to the new rules: changes to
  temporary tables are written to the binary log in the
  boundaries of a transaction if there is any.
mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result:
  Updated the unsafe message.
mysql-test/suite/rpl/r/rpl_temp_temporary.result:
  Added a test case.
mysql-test/suite/rpl/t/rpl000013.test:
  Suppressed warning messages due to the following cases:
  
     1 - INSERT INTO t_myisam SELECT * FROM t_myisam_temp
  
     2 - INSERT INTO t_myisam_temp SELECT * FROM t_myisam
  
     3 - CREATE TEMPORARY TABLE t_myisam_temp SELECT * FROM t_myisam
mysql-test/suite/rpl/t/rpl_misc_functions.test:
  Suppressed warning messages.
mysql-test/suite/rpl/t/rpl_temp_table.test:
  Suppressed warning messages due to the following cases:
  
     1 - INSERT INTO t_myisam SELECT * FROM t_myisam_temp
  
     2 - INSERT INTO t_myisam_temp SELECT * FROM t_myisam
  
     3 - CREATE TEMPORARY TABLE t_myisam_temp SELECT * FROM t_myisam
mysql-test/suite/rpl/t/rpl_temp_temporary.test:
  Added a test case.
mysql-test/suite/rpl/t/rpl_temporary.test:
  Suppressed warning messages due to the following cases:
  
     1 - INSERT INTO t_myisam SELECT * FROM t_myisam_temp
  
     2 - INSERT INTO t_myisam_temp SELECT * FROM t_myisam
  
     3 - CREATE TEMPORARY TABLE t_myisam_temp SELECT * FROM t_myisam
mysql-test/suite/rpl_ndb/r/rpl_ndb_row_implicit_commit_binlog.result:
  Updated the test case due to the new rules: changes to
  temporary tables are written to the binary log in the
  boundaries of a transaction if there is any.
mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result:
  Updated the test case to remove references to positions
  in the binary log.
mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb.test:
  Updated the test case to remove references to positions
  in the binary log.
mysql-test/t/create_select_tmp.test:
  Suppressed warning messages due to the following cases:
  
     1 - INSERT INTO t_myisam SELECT * FROM t_myisam_temp
  
     2 - INSERT INTO t_myisam_temp SELECT * FROM t_myisam
  
     3 - CREATE TEMPORARY TABLE t_myisam_temp SELECT * FROM t_myisam
mysql-test/t/ctype_cp932_binlog_stm.test:
  Suppressed warning messages due to the following cases:
  
     1 - INSERT INTO t_myisam SELECT * FROM t_myisam_temp
  
     2 - INSERT INTO t_myisam_temp SELECT * FROM t_myisam
  
     3 - CREATE TEMPORARY TABLE t_myisam_temp SELECT * FROM t_myisam
mysql-test/t/mysqlbinlog.test:
  Suppressed warning messages due to the following cases:
  
     1 - INSERT INTO t_myisam SELECT * FROM t_myisam_temp
  
     2 - INSERT INTO t_myisam_temp SELECT * FROM t_myisam
  
     3 - CREATE TEMPORARY TABLE t_myisam_temp SELECT * FROM t_myisam
sql/log.cc:
  Improved the code by creating several functions to hide decision
  on type of engine changed, commit/abort, etc:  
  
  . stmt_has_updated_non_trans_table
  
  . trans_has_updated_non_trans_table
  
  . ending_trans
  
  Updated the binlog_rollback function and the use of the 
  OPTION_KEEP_LOG which indincates when a temporary table was
  either created or dropped and as such the command must be 
  logged if not in MIXED mode and even while rolling back the
  transaction.
sql/log.h:
  Improved the code by creating several functions to hide decision
  on type of engine changed, commit/abort, etc.
sql/log_event.cc:
  Removed the setting of the OPTION_KEEP_LOG as it is related to CREATE
  TEMPORARY and DROP TEMPORARY and not to the type of engine (i.e.
  transactional or non-transactional).
sql/log_event_old.cc:
  Removed the setting of the OPTION_KEEP_LOG as it is related to CREATE
  TEMPORARY and DROP TEMPORARY and not to the type of engine (i.e.
  transactional or non-transactional).
sql/share/errmsg-utf8.txt:
  Updated the unsafe message.
sql/sql_class.cc:
  Classifies the following statements as unsafe:
     1 - INSERT INTO t_myisam SELECT * FROM t_myisam_temp
  
     2 - INSERT INTO t_myisam_temp SELECT * FROM t_myisam
  
  On the other hand, the following statements are classified as safe:
  
     1 - INSERT INTO t_innodb SELECT * FROM t_myisam_temp
  
     2 - INSERT INTO t_myisam_temp SELECT * FROM t_innodb
sql/sql_class.h:
  It allows to switch from STATEMENT to MIXED/ROW when there are temporary
  tables but the contrary is not possible.
sql/sql_table.cc:
  Fixed the case that a DROP/DROP TEMPORARY that affects a temporary table in MIXED
  mode is written as a DROP TEMPORARY TABLE IF EXISTS because the table may not exist in the slave and due to the IF EXISTS token an error will never happen
  while processing the statement in the slave.
  
  Removed a function that was not being used.
2010-04-20 10:10:43 +01:00
Alexey Kopytov
3df8e88dd8 Manual merge of mysql-5.1-bugteam into mysql-trunk-merge.
Conflicts:

Text conflict in mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
Text conflict in sql/log.cc
Text conflict in sql/set_var.cc
Text conflict in sql/sql_class.cc
2010-04-03 21:35:51 +04:00
unknown
454c003a5c Bug #50407 mysqlbinlog --database=X produces bad output for SAVEPOINTs
When mysqlbinlog was given the --database=X flag, it always printed
'ROLLBACK TO', but the corresponding 'SAVEPOINT' statement was not
printed. The replicated filter(replicated-do/ignore-db) and binlog
filter (binlog-do/ignore-db) has the same problem. They are solved
in this patch together.

After this patch, We always check whether the query is 'SAVEPOINT'
statement or not. Because this is a literal check, 'SAVEPOINT' and
'ROLLBACK TO' statements are also binlogged in uppercase with no
any comments.

The binlog before this patch can be handled correctly except one case
that any comments are in front of the keywords. for example:
 /* bla bla */ SAVEPOINT a;
 /* bla bla */ ROLLBACK TO a;
2010-03-28 19:57:33 +08:00
Luis Soares
f0b38904aa BUG#48993: valgrind errors in mysqlbinlog
I found three issues during the analysis:
 1. Memory leak caused by temp_buf not being freed;
 2. Memory leak caused when handling argv;
 3. Conditional jump that depended on unitialized values.

Issue #1
--------

  DESCRIPTION: when mysqlbinlog is reading from a remote location
  the event temp_buf references the incoming stream (in NET
  object), which is not freed by mysqlbinlog explicitly. On the
  other hand, when it is reading local binary log, it points to a
  temporary buffer that needs to be explicitly freed. For both
  cases, the temp_buf was not freed by mysqlbinlog, instead was
  set to 0.  This clearly disregards the free required in the
  second case, thence creating a memory leak.

  FIX: we make temp_buf to be conditionally freed depending on
  the value of remote_opt. Found out that similar fix is already
  in most recent codebases.

Issue #2 
--------

  DESCRIPTION: load_defaults is called by parse_args, and it
  reads default options from configuration files and put them
  BEFORE the arguments that are already in argc and argv. This is
  done resorting to MEM_ROOT. However, parse_args calls
  handle_options immediately after which changes argv. Later when
  freeing the defaults, pointers to MEM_ROOT won't match, causing
  the memory not to be freed:

  void free_defaults(char **argv)
  {
    MEM_ROOT ptr
    memcpy_fixed((char*) &ptr,(char *) argv - sizeof(ptr), sizeof(ptr));
    free_root(&ptr,MYF(0));
  }

  FIX: we remove load_defaults from parse_args and call it
  before. Then we save argv with defaults in defaults_argv BEFORE
  calling parse_args (which inside can then call handle_options
  at will). Actually, found out that this is in fact kind of a
  backport for BUG#38468 into 5.1, so I merged in the test case
  as well and added error check for load_defaults call.

  Fix based on:
  revid:zhenxing.he@sun.com-20091002081840-uv26f0flw4uvo33y


Issue #3 
--------

  DESCRIPTION: the structure st_print_event_info constructor
  would not initialize the sql_mode member, although it did for
  sql_mode_inited (set to false). This would later raise the
  warning in valgrind when printing the sql_mode in the event
  header, as this print out is protected by a check against
  sql_mode_inited and sql_mode variables. Given that sql_mode was
  not initialized valgrind would output the warning.

  FIX: we add initialization of sql_mode to the
  st_print_event_info constructor.
 

client/mysqlbinlog.cc:
  - Conditionally free ev->temp_buf.
  - save defaults_argv before handle_options is called.
mysql-test/t/mysqlbinlog.test:
  Added test case from BUG#38468.
sql/log_event.cc:
  Added initialization of sql_mode for st_print_event_info.
2010-02-17 18:07:28 +00:00
Magne Mahre
7178879c80 WL#5154 Remove deprecated 4.1 features
A set of program options and variables was deprecated in
MySQL 5.1, and is hereby removed.



client/mysql.cc:
  --no-auto-rehash (-A)  is no longer deprecated
  --no-named-commands (-g) is now removed
  --skip-line-numbers (-L) is no longer deprecated
  --set-variable (-O) is now removed
  --no-pager is now removed
client/mysqlbinlog.cc:
  --position is now removed (use --start-position)
  -j is now equivalent with --start-position
client/mysqldump.c:
  --first-slave is now removed
  --no-set-names (-N) is now removed
  --set-variable (-O) is now removed
mysql-test/include/default_mysqld.cnf:
  default-character-set is removed as an option
  character-set-server is equivalent.
mysql-test/t/bug47671-master.opt:
  default-character-set option is removed
  character-set-server is equivalent
mysql-test/t/ctype_latin1_de-master.opt:
  default-character-set option is removed
  character-set-server is equivalent
mysql-test/t/ctype_ucs2_def-master.opt:
  default-collation is removed
  collation-server is equicalent
scripts/mysqld_multi.sh:
  --config-file has been superseded by
  --defaults-extra-file
sql/mysql_priv.h:
  Removed the version number in the deprecation
  warning text, as decided by ServerPT.
sql/mysqld.cc:
  --default-character-set (-C) is removed
  --default-collation is removed
  --log-long-format (-0) is removed
  --safe-show-database is removed
  --set-variable (-O) is removed
sql/sql_yacc.yy:
  The FRAC_SECOND keyword is removed
sql/sys_vars.cc:
  The sql_log_update system variable is removed
2010-02-17 10:18:17 +01:00
Alexander Nozdrin
c730af0ecf Fix manual merge error. 2010-01-20 23:22:43 +03:00
Luis Soares
595719280e BUG#49479: Slave stops with syntax error: LOAD DATA event without
escaped field names

When in mixed or statement mode, the master logs LOAD DATA
queries by resorting to an Execute_load_query_log_event. This
event does not contain the original query, but a rewritten
version of it, which includes the table field names. However, the
rewrite does not escape the field names. If these names match a
reserved keyword, then the slave will stop with a syntax error
when executing the event.

We fix this by escaping the fields names as it happens already
for the table name.

mysql-test/extra/rpl_tests/rpl_loaddata.test:
  Added test case for the reported bug.
mysql-test/r/mysqlbinlog.result:
  Changed result to support escaped field name.
mysql-test/suite/binlog/r/binlog_killed_simulate.result:
  Changed result to support escaped field name.
mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result:
  Changed result to support escaped field name.
mysql-test/suite/binlog/r/binlog_stm_blackhole.result:
  Changed result to support escaped field name.
mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result:
  Changed result to support escaped field name.
mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result:
  Changed result to support escaped field name.
mysql-test/suite/rpl/r/rpl_loaddata.result:
  Added result for new test. 
  Changed show slave status positions which are now different because of
  extra escape character in field names.
mysql-test/suite/rpl/r/rpl_loaddata_fatal.result:
  Changed show slave status positions which are now different because of
  extra escape character.
mysql-test/suite/rpl/r/rpl_loaddata_map.result:
  Changed result to support escaped field name.
mysql-test/suite/rpl/r/rpl_stm_log.result:
  Changed result to support escaped field name.
mysql-test/t/mysqlbinlog.test:
  Changed positions which is now different because of extra escape 
  character in field names.
sql/sql_load.cc:
  Appended escape characters before and after field names.
2009-12-06 01:11:32 +00:00
Andrei Elkin
7eb789a723 merging 5.1 main -> 5.1-rep+2 -> 5.1-rep+3; binlog_unsafe , rpl_mysql_upgrade fail and are under treatment 2009-11-10 20:45:15 +02:00
Andrei Elkin
3c1e1f6d6c merging 5.1 main -> rpl+2. Some manual work required mostly due to bug46640 2009-11-06 18:35:04 +02:00
Alfranio Correia
19c380aaff WL#2687 WL#5072 BUG#40278 BUG#47175
Non-transactional updates that take place inside a transaction present problems
for logging because they are visible to other clients before the transaction
is committed, and they are not rolled back even if the transaction is rolled
back. It is not always possible to log correctly in statement format when both
transactional and non-transactional tables are used in the same transaction.

In the current patch, we ensure that such scenario is completely safe under the
ROW and MIXED modes.
2009-11-03 19:02:56 +00:00
He Zhenxing
bb6953d1d8 Backport BUG#38468 Memory leak detected when using mysqlbinlog utility
There were two memory leaks in mysqlbinlog command, one was already
fixed by previous patches, another one was that defaults_argv was
set to the value of argv after parse_args, in which called
handle_options after calling load_defaults and changed the value
of argv, and caused the memory allocated for defaults arguments
not freed.

Fixed the problem by setting defaults_argv right after calling
load_defaults.
2009-10-02 16:18:40 +08:00
Andrei Elkin
d91aa57c38 backporting bug@27808 fixes 2009-10-01 19:44:53 +03:00
unknown
508527a94c Bug #46998 mysqlbinlog can't output BEGIN even if the database is included in a transaction
The 'BEGIN/COMMIT/ROLLBACK' log event could be filtered out if the
database is not selected by --database option of mysqlbinlog command.
This can result in problem if there are some statements in the
transaction are not filtered out.

To fix the problem, mysqlbinlog will output 'BEGIN/ROLLBACK/COMMIT' 
in regardless of the database filtering rules.

client/mysqlbinlog.cc:
  Skip the database check for BEGIN/COMMIT/ROLLBACK log events.
mysql-test/r/mysqlbinlog.result:
  Test result for bug#46998
mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_db_filter.test:
  The test case is updated duo to the patch of bug#46998
mysql-test/t/mysqlbinlog.test:
  Added test to verify if the 'BEGIN', 'COMMIT' and 'ROLLBACK' are output
  in regardless of database filtering
2009-09-30 10:31:25 +08:00
unknown
de04eb6c37 Bug #46998 mysqlbinlog can't output BEGIN even if the database is included in a transaction
The 'BEGIN/COMMIT/ROLLBACK' log event could be filtered out if the
database is not selected by --database option of mysqlbinlog command.
This can result in problem if there are some statements in the
transaction are not filtered out.

To fix the problem, mysqlbinlog will output 'BEGIN/ROLLBACK/COMMIT' 
in regardless of the database filtering rules.

client/mysqlbinlog.cc:
  Skip the database check for BEGIN/COMMIT/ROLLBACK log events.
mysql-test/r/mysqlbinlog.result:
  Test result for bug#46998
mysql-test/t/mysqlbinlog.test:
  Added test to verify if the 'BEGIN', 'COMMIT' and 'ROLLBACK' are output
  in regardless of database filtering
2009-09-30 10:01:52 +08:00
Andrei Elkin
5983785ef4 WL#342 heartbeat
backporting from 6.0 code base to 5.1.
2009-09-29 14:16:23 +03: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
Alexey Kopytov
5390ad33f9 Manual merge. 2009-05-08 21:24:15 +04:00
Alexey Kopytov
c0cd2742af Bug #41943: mysqlbinlog.exe crashes if --hexdump option is used
The --hexdump option crashed mysqlbinlog when used together  
with the --read-from-remote-server option due to use of  
uninitialized memory.  
  
Since Log_event::print_header() relies on temp_buf to be  
initialized when the --hexdump option is present,  
dump_remote_log_entries() was fixed to setup temp_buf to point  
to the start of a binlog event as done in  
dump_local_log_entries().  
 
The root cause of this bug is identical to the one for 
bug #17654. The latter was fixed in 5.1 and up, so this 
patch is backport of the patches for bug #17654 to 5.0. 
 
Only 5.0 needs a changelog entry. 

client/mysqlbinlog.cc:
  Fixed dump_remote_log_entries() so that temp_buf is initialized 
  as it may be used later by Log_event::print_header() if the 
  --hexdump option is present.
mysql-test/r/mysqlbinlog.result:
  Added a test case for bug #41943.
mysql-test/t/mysqlbinlog.test:
  Added a test case for bug #41943.
2009-05-07 18:31:02 +04:00
Matthias Leich
2417d31045 Merge 5.0 -> 5.1 of fix for Bug#42003 and Bug#43114 2009-03-06 15:56:17 +01:00
Matthias Leich
0183d4d842 Merge of fix for Bug#42003 and Bug#43114 into more actual GCA tree
modifications according to the reviews are included
2009-03-05 14:35:03 +01:00
Matthias Leich
140cc614c9 Last slice of fix for Bug#42003 tests missing the disconnect of connections <> default
+ Fix for Bug#43114 wait_until_count_sessions too restrictive, random PB failures
+ Removal of a lot of other weaknesses found
+ modifications according to review
2009-03-03 21:34:18 +01:00
Andrei Elkin
5b0721786e merging bug#37313fixes from 5.0-bt to 5.1-bt 2009-02-24 16:59:46 +02:00
Andrei Elkin
a6ac350b3a merging from 5.0-bt rep to a local branch 2009-02-24 16:35:45 +02:00
Andrei Elkin
d091deaf89 fixing compilation warning and adding flush logs to test of bug#37313 2009-02-24 16:17:34 +02:00
Alexey Kopytov
144763db0c Manual merge mysql-5.0-bugteam -> mysql-5.1-bugteam. 2009-02-23 17:16:46 +02:00