Skip to content

Commit 9a7db56

Browse files
author
Manish Kumar
committed
BUG#11747887:34386: MYSQLBINLOG --HEXDUMP PRINTS LAST ROW OF HEXDUMP INCORRECTLY
Problem description: when mysqlbinlog --hexdump prints events, it prints the last row of the hexdump incorrectly. If the last row has eight bytes,the end of the second last row is copied to the end of the last row,padding the row to full length. If the last row has less than sixteen bytes, the textual representation is not aligned with the previous row. Fix: the bug was removed by padding the last line with the required number of spaces in the last line.
1 parent 5f843e1 commit 9a7db56

File tree

4 files changed

+108
-0
lines changed

4 files changed

+108
-0
lines changed
451 Bytes
Binary file not shown.
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
include/master-slave.inc
2+
[connection master]
3+
include/rpl_reset.inc
4+
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
5+
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
6+
DELIMITER /*!*/;
7+
# at 4
8+
#110927 20:57:19 server id 1 end_log_pos 114
9+
# Position Timestamp Type Master ID Size Master Pos Flags
10+
# 4 7f 0e 82 4e 0f 01 00 00 00 6e 00 00 00 72 00 00 00 00 00
11+
# 17 04 00 35 2e 36 2e 34 2d 6d 35 2d 64 65 62 75 67 |..5.6.4.m5.debug|
12+
# 27 2d 6c 6f 67 00 00 00 00 00 00 00 00 00 00 00 00 |.log............|
13+
# 37 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
14+
# 47 00 00 00 00 7f 0e 82 4e 13 38 0d 00 08 00 12 00 |.......N.8......|
15+
# 57 04 04 04 04 12 00 00 56 00 04 1a 08 00 00 00 08 |.......V........|
16+
# 67 08 08 02 00 00 00 00 93 fa cd dc |...........|
17+
# Start: binlog v 4, server v 5.6.4-m5-debug-log created 110927 20:57:19 at startup
18+
ROLLBACK/*!*/;
19+
BINLOG '
20+
fw6CTg8BAAAAbgAAAHIAAAAAAAQANS42LjQtbTUtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA
21+
AAAAAAAAAAAAAAAAAAB/DoJOEzgNAAgAEgAEBAQEEgAAVgAEGggAAAAICAgCAAAAAJP6zdw=
22+
'/*!*/;
23+
# at 114
24+
#110927 20:57:23 server id 1 end_log_pos 231
25+
# Position Timestamp Type Master ID Size Master Pos Flags
26+
# 72 83 0e 82 4e 02 01 00 00 00 75 00 00 00 e7 00 00 00 00 00
27+
# 85 01 00 00 00 00 00 00 00 04 00 00 21 00 00 00 00 |................|
28+
# 95 00 00 01 00 00 00 00 00 00 00 00 06 03 73 74 64 |.............std|
29+
# a5 04 21 00 21 00 08 00 0c 01 74 65 73 74 00 74 65 |.........test.te|
30+
# b5 73 74 00 63 72 65 61 74 65 20 74 61 62 6c 65 20 |st.create.table.|
31+
# c5 74 31 20 28 61 20 65 6e 75 6d 28 27 6f 6e 65 27 |t1..a.enum..one.|
32+
# d5 2c 20 27 74 77 6f 27 2c 20 27 74 68 72 65 65 27 |...two....three.|
33+
# e5 29 29 |..|
34+
# Query thread_id=1 exec_time=0 error_code=0
35+
use test/*!*/;
36+
SET TIMESTAMP=1317146243/*!*/;
37+
SET @@session.pseudo_thread_id=1/*!*/;
38+
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
39+
SET @@session.sql_mode=0/*!*/;
40+
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
41+
/*!\C utf8 *//*!*/;
42+
SET @@session.character_set_client=33,@@session.collation_connection=33,@@session.collation_server=8/*!*/;
43+
SET @@session.lc_time_names=0/*!*/;
44+
SET @@session.collation_database=DEFAULT/*!*/;
45+
create table t1 (a enum('one', 'two', 'three'))
46+
/*!*/;
47+
# at 231
48+
#110927 20:57:25 server id 1 end_log_pos 306
49+
# Position Timestamp Type Master ID Size Master Pos Flags
50+
# e7 85 0e 82 4e 02 01 00 00 00 4b 00 00 00 32 01 00 00 08 00
51+
# fa 01 00 00 00 00 00 00 00 04 00 00 21 00 00 00 00 |................|
52+
# 10a 00 00 01 00 00 00 00 00 00 00 00 06 03 73 74 64 |.............std|
53+
# 11a 04 21 00 21 00 08 00 0c 01 74 65 73 74 00 74 65 |.........test.te|
54+
# 12a 73 74 00 42 45 47 49 4e |st.BEGIN|
55+
# Query thread_id=1 exec_time=0 error_code=0
56+
SET TIMESTAMP=1317146245/*!*/;
57+
BEGIN
58+
/*!*/;
59+
# at 306
60+
#110927 20:57:25 server id 1 end_log_pos 405
61+
# Position Timestamp Type Master ID Size Master Pos Flags
62+
# 132 85 0e 82 4e 02 01 00 00 00 63 00 00 00 95 01 00 00 00 00
63+
# 145 01 00 00 00 00 00 00 00 04 00 00 21 00 00 00 00 |................|
64+
# 155 00 00 01 00 00 00 00 00 00 00 00 06 03 73 74 64 |.............std|
65+
# 165 04 21 00 21 00 08 00 0c 01 74 65 73 74 00 74 65 |.........test.te|
66+
# 175 73 74 00 69 6e 73 65 72 74 20 69 6e 74 6f 20 74 |st.insert.into.t|
67+
# 185 31 20 76 61 6c 75 65 73 20 28 27 74 77 6f 27 29 |1.values...two..|
68+
# Query thread_id=1 exec_time=0 error_code=0
69+
SET TIMESTAMP=1317146245/*!*/;
70+
insert into t1 values ('two')
71+
/*!*/;
72+
# at 405
73+
#110927 20:57:25 server id 1 end_log_pos 432
74+
# Position Timestamp Type Master ID Size Master Pos Flags
75+
# 195 85 0e 82 4e 10 01 00 00 00 1b 00 00 00 b0 01 00 00 00 00
76+
# 1a8 07 00 00 00 00 00 00 00 |........|
77+
# Xid = 7
78+
COMMIT/*!*/;
79+
# at 432
80+
#110927 20:57:30 server id 1 end_log_pos 451
81+
# Position Timestamp Type Master ID Size Master Pos Flags
82+
# 1b0 8a 0e 82 4e 03 01 00 00 00 13 00 00 00 c3 01 00 00 00 00
83+
# Stop
84+
DELIMITER ;
85+
# End of log file
86+
ROLLBACK /* added by mysqlbinlog */;
87+
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
88+
include/rpl_end.inc
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#
2+
# Bug#11747887 - 34386: MYSQLBINLOG --HEXDUMP PRINTS LAST ROW OF HEXDUMP
3+
# INCORRECTLY
4+
#
5+
6+
--source include/master-slave.inc
7+
--source include/rpl_reset.inc
8+
9+
--sync_slave_with_master
10+
11+
--let $MYSQLD_DATADIR= `select @@datadir`
12+
13+
--exec $MYSQL_BINLOG --hexdump std_data/bug11747887-bin.000002
14+
15+
--source include/rpl_end.inc

sql/log_event.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,6 +1677,11 @@ void Log_event::print_header(IO_CACHE* file,
16771677
if (hex_string[0])
16781678
{
16791679
char emit_buf[256];
1680+
int pad_length= 48 - strlen(h);
1681+
DBUG_ASSERT(strlen(h) < 48);
1682+
for(int pad_done= 0; pad_done < pad_length; pad_done++)
1683+
*h++ = ' ';
1684+
*h= '\0';
16801685
size_t const bytes_written=
16811686
my_snprintf(emit_buf, sizeof(emit_buf),
16821687
"# %8.8lx %-48.48s |%s|\n",

0 commit comments

Comments
 (0)