summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <sven@riska.(none)>2008-01-30 14:12:40 +0100
committerunknown <sven@riska.(none)>2008-01-30 14:12:40 +0100
commited9e73077dd9562b77485fc034f5e3b7688b5dd0 (patch)
tree6537fbb33b4be7c1c0769099c1b01941cbf4f659 /mysql-test
parent5efbdc906ca9eccf609221d05fa2f0c84bf973ad (diff)
downloadmariadb-git-ed9e73077dd9562b77485fc034f5e3b7688b5dd0.tar.gz
BUG#34141: mysqlbinlog cannot read 4.1 binlogs containing load data infile
Main problem: mysql 5.1 cannot read binlogs from 4.1. Subproblem 1: There is a mistake in sql_ex_info::init. The read_str() function updates its first argument to point to the next character to read. However, it is applied only to a copy of the buffer pointer, so the real buffer pointer is not updated. Fix 1: do not take a copy of the buffer pointer. The copy was needed because sql_ex_info::init does not use the const attribute on some of its arguments. So we add the const attribute, too. Subproblem 2: The first BINLOG statement is asserted to be a FORMAT_DESCRIPTION_LOG_EVENT, but 4.1 binlogs begin with START_EVENT_V3. Fix 2: allow START_EVENT_V3 too. mysql-test/suite/binlog/std_data/binlog_old_version_4_1.000001: New BitKeeper file ``mysql-test/suite/binlog/std_data/binlog_old_version_4_1.000001'' mysql-test/suite/binlog/r/binlog_old_versions.result: Updated result file. mysql-test/suite/binlog/t/binlog_old_versions.test: Added a test reading an old 4.1 binlog. sql/log_event.cc: 1. Added const keyword at the following places: - input buffer for pretty_print_str - input buffer for write_str - input buffer, end pointer, and return value from sql_ex_info::init 2. Fixed the bug by not taking a copy of buf before calling read_str in sql_ex_info::init(). sql/log_event.h: Added const keyword to fields of the sql_ex_info struct. Added const keyword to arguments and return value of sql_ex_info::init sql/sql_binlog.cc: The first BINLOG statement must describe the format for future BINLOG statements. Otherwise, we do not know how to read the BINLOG statement. Problem: only FORMAT_DESCRIPTION_EVENT is currently allowed as the first event. Binlogs from 4.1 begin with a START_EVENT_V3, which serves the same purpose. Fix: We now allow the first BINLOG statement to be a START_EVENT_V3, as well as a FORMAT_DESCRIPTION_EVENT.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/suite/binlog/r/binlog_old_versions.result10
-rw-r--r--mysql-test/suite/binlog/std_data/binlog_old_version_4_1.000001bin0 -> 149436 bytes
-rw-r--r--mysql-test/suite/binlog/t/binlog_old_versions.test15
3 files changed, 25 insertions, 0 deletions
diff --git a/mysql-test/suite/binlog/r/binlog_old_versions.result b/mysql-test/suite/binlog/r/binlog_old_versions.result
index a514f9278a6..77289252b4c 100644
--- a/mysql-test/suite/binlog/r/binlog_old_versions.result
+++ b/mysql-test/suite/binlog/r/binlog_old_versions.result
@@ -29,6 +29,16 @@ SELECT COUNT(*) FROM t3;
COUNT(*)
17920
DROP TABLE t1, t2, t3;
+==== Read binlog from version 4.1 ====
+SELECT * FROM t1 ORDER BY a;
+a b
+0 last_insert_id
+4 four
+190243 random
+SELECT COUNT(*) FROM t3;
+COUNT(*)
+17920
+DROP TABLE t1, t3;
==== Read binlog from alcatel tree (mysql-5.1-wl2325-5.0-drop6) ====
SELECT * FROM t1 ORDER BY a;
a b
diff --git a/mysql-test/suite/binlog/std_data/binlog_old_version_4_1.000001 b/mysql-test/suite/binlog/std_data/binlog_old_version_4_1.000001
new file mode 100644
index 00000000000..66db9668d46
--- /dev/null
+++ b/mysql-test/suite/binlog/std_data/binlog_old_version_4_1.000001
Binary files differ
diff --git a/mysql-test/suite/binlog/t/binlog_old_versions.test b/mysql-test/suite/binlog/t/binlog_old_versions.test
index 9fb7343e761..b2922809b1b 100644
--- a/mysql-test/suite/binlog/t/binlog_old_versions.test
+++ b/mysql-test/suite/binlog/t/binlog_old_versions.test
@@ -51,6 +51,21 @@ SELECT COUNT(*) FROM t3;
DROP TABLE t1, t2, t3;
+--echo ==== Read binlog from version 4.1 ====
+
+# In this version, neither row-based binlogging nor Xid events
+# existed, so the binlog was generated without the "row-based tests"
+# part and the "get xid event" part, and it does not create table t2.
+
+# Read binlog.
+--exec $MYSQL_BINLOG suite/binlog/std_data/binlog_old_version_4_1.000001 | $MYSQL
+# Show result.
+SELECT * FROM t1 ORDER BY a;
+SELECT COUNT(*) FROM t3;
+# Reset.
+DROP TABLE t1, t3;
+
+
--echo ==== Read binlog from alcatel tree (mysql-5.1-wl2325-5.0-drop6) ====
# In this version, it was not possible to switch between row-based and