]>
Commit | Line | Data |
---|---|---|
543222d2 AM |
1 | --- /dev/null |
2 | +++ b/mysql-test/r/percona_bug933969.result | |
3 | @@ -0,0 +1,16 @@ | |
4 | +RESET MASTER; | |
5 | +DROP TABLE IF EXISTS t1; | |
6 | +CREATE TABLE t1 (word VARCHAR(20)); | |
7 | +INSERT INTO t1 VALUES ("hamite"); | |
8 | +INSERT INTO t1 VALUES ("hoho"); | |
9 | +INSERT INTO t1 VALUES ("znamenito"); | |
10 | +INSERT INTO t1 VALUES ("mrachny"); | |
11 | +INSERT INTO t1 VALUES ("mrak"); | |
12 | +INSERT INTO t1 VALUES ("zhut"); | |
13 | +INSERT INTO t1 VALUES ("parnisha"); | |
14 | +INSERT INTO t1 VALUES ("krrasota!"); | |
15 | +INSERT INTO t1 VALUES ("podumayesh"); | |
16 | +INSERT INTO t1 VALUES ("ogo!"); | |
17 | +FLUSH LOGS; | |
18 | +DROP TABLE t1; | |
19 | +RESET MASTER; | |
20 | --- /dev/null | |
21 | +++ b/mysql-test/t/percona_bug933969.test | |
22 | @@ -0,0 +1,42 @@ | |
23 | +###################### percona_bug933969.test ######################## | |
24 | +# Bug #933969: mysqlbinlog doesn't accept stdin # | |
25 | +# # | |
26 | +# The goal of this testcase is to test that mysqlbinlog handle # | |
27 | +# stdin correctly when stdin is pipe. # | |
28 | +# i.e. "cat log | mysqlbinlog -" don't cause mysqlbinlog failure # | |
29 | +###################################################################### | |
30 | +-- source include/have_log_bin.inc | |
31 | +-- source include/not_windows.inc | |
32 | +-- source include/not_embedded.inc | |
33 | + | |
34 | +# deletes all the binary logs | |
35 | +RESET MASTER; | |
36 | + | |
37 | +--disable_warnings | |
38 | +DROP TABLE IF EXISTS t1; | |
39 | +--enable_warnings | |
40 | + | |
41 | +# produce some statements for binlog | |
42 | + | |
43 | +CREATE TABLE t1 (word VARCHAR(20)); | |
44 | + | |
45 | +INSERT INTO t1 VALUES ("hamite"); | |
46 | +INSERT INTO t1 VALUES ("hoho"); | |
47 | +INSERT INTO t1 VALUES ("znamenito"); | |
48 | +INSERT INTO t1 VALUES ("mrachny"); | |
49 | +INSERT INTO t1 VALUES ("mrak"); | |
50 | +INSERT INTO t1 VALUES ("zhut"); | |
51 | +INSERT INTO t1 VALUES ("parnisha"); | |
52 | +INSERT INTO t1 VALUES ("krrasota!"); | |
53 | +INSERT INTO t1 VALUES ("podumayesh"); | |
54 | +INSERT INTO t1 VALUES ("ogo!"); | |
55 | + | |
56 | +FLUSH LOGS; | |
57 | + | |
58 | +# run mysqlbinlog and make sure it ends normally | |
59 | + | |
60 | +let $MYSQLD_DATADIR= `SELECT @@datadir`; | |
61 | +--system cat $MYSQLD_DATADIR/master-bin.000001 | $MYSQL_BINLOG - >/dev/null | |
62 | + | |
63 | +DROP TABLE t1; | |
64 | +RESET MASTER; | |
65 | --- a/client/mysqlbinlog.cc | |
66 | +++ b/client/mysqlbinlog.cc | |
67 | @@ -1760,7 +1760,7 @@ | |
68 | } | |
69 | ||
70 | pos= my_b_tell(file); | |
71 | - my_b_seek(file, (my_off_t)0); | |
72 | + DBUG_ASSERT(pos == 0); | |
73 | if (my_b_read(file, header, sizeof(header))) | |
74 | { | |
75 | error("Failed reading header; probably an empty file."); | |
76 | @@ -1920,7 +1920,7 @@ | |
77 | /* read from normal file */ | |
78 | if ((fd = my_open(logname, O_RDONLY | O_BINARY, MYF(MY_WME))) < 0) | |
79 | return ERROR_STOP; | |
80 | - if (init_io_cache(file, fd, 0, READ_CACHE, start_position_mot, 0, | |
81 | + if (init_io_cache(file, fd, 0, READ_CACHE, (my_off_t) 0, 0, | |
82 | MYF(MY_WME | MY_NABP))) | |
83 | { | |
84 | my_close(fd, MYF(MY_WME)); | |
85 | @@ -1928,6 +1928,7 @@ | |
86 | } | |
87 | if ((retval= check_header(file, print_event_info, logname)) != OK_CONTINUE) | |
88 | goto end; | |
89 | + my_b_seek(file, start_position_mot); | |
90 | } | |
91 | else | |
92 | { |