3770 Bjorn Munch 2012-07-10
mysql_client_fw.c was not included in make dist
modified:
tests/Makefile.am
3769 Sujatha Sivakumar 2012-07-10
BUG#11762670:MY_B_WRITE RETURN VALUE IGNORED
Problem:
=======
The return value from my_b_write is ignored by: `my_b_write_quoted',
`my_b_write_bit',`Query_log_event::print_query_header'
Most callers of `my_b_printf' ignore the return value. `log_event.cc'
has many calls to it.
Analysis:
========
`my_b_write' is used to write data into a file. If the write fails it
sets appropriate error number and error message through my_error()
function call and sets the IO_CACHE::error == -1.
`my_b_printf' function is also used to write data into a file, it
internally invokes my_b_write to do the write operation. Upon
success it returns number of characters written to file and on error
it returns -1 and sets the error through my_error() and also sets
IO_CACHE::error == -1. Most of the event specific print functions
for example `Create_file_log_event::print', `Execute_load_log_event::print'
etc are the ones which make several calls to the above two functions and
they do not check for the return value after the 'print' call. All the above
mentioned abuse cases deal with the client side.
Fix:
===
As part of bug fix a check for IO_CACHE::error == -1 has been added at
a very high level after the call to the 'print' function. There are
few more places where the return value of "my_b_write" is ignored
those are mentioned below.
+++ mysys/mf_iocache2.c 2012-06-04 07:03:15 +0000
@@ -430,7 +430,8 @@
memset(buffz, '0', minimum_width - length2);
else
memset(buffz, ' ', minimum_width - length2);
- my_b_write(info, buffz, minimum_width - length2);
+++ sql/log.cc 2012-06-08 09:04:46 +0000
@@ -2388,7 +2388,12 @@
{
end= strxmov(buff, "# administrator command: ", NullS);
buff_len= (ulong) (end - buff);
- my_b_write(&log_file, (uchar*) buff, buff_len);
At these places appropriate return value handlers have been added.
@ client/mysqlbinlog.cc
check for IO_CACHE::error == -1 has been added after the call to
the event specific print functions
@ internal/mysql-test/suite/i_binlog/r/binlog_mysqlbinlog_file_write.result
Result file has been updated with test results for BUG#11762670
@ internal/mysql-test/suite/i_binlog/t/binlog_mysqlbinlog_file_write.test
Added test cases for testing the fix for BUG11762670.
@ internal/mysql-test/suite/i_main/r/slow_log_write_errchk.result
Result file for test `slow_log_write_errchk.test'.
@ internal/mysql-test/suite/i_main/t/slow_log_write_errchk-master.opt
Option file includes two options, one to enable 'admin commands' to be logged
in slow log file. The other option specifies the name for slow log file.
@ internal/mysql-test/suite/i_main/t/slow_log_write_errchk.test
Test script to test error handling when a write operation to the slow log file
fails.
@ mysys/mf_iocache2.c
Added handler to check the written value of `my_b_write'
@ sql/log.cc
Added handler to check the written value of `my_b_write'
@ sql/log_event.cc
Added error simulation statements in `Create_file_log_event::print`
and `Execute_load_query_log_event::print'
@ sql/rpl_utility.h
Removed the extra ';'
added:
internal/mysql-test/suite/i_main/r/slow_log_write_errchk.result
internal/mysql-test/suite/i_main/t/slow_log_write_errchk-master.opt
internal/mysql-test/suite/i_main/t/slow_log_write_errchk.test
modified:
client/mysqlbinlog.cc
internal/mysql-test/suite/i_binlog/r/binlog_mysqlbinlog_file_write.result
internal/mysql-test/suite/i_binlog/t/binlog_mysqlbinlog_file_write.test
mysys/mf_iocache2.c
sql/log.cc
sql/log_event.cc
sql/rpl_utility.h
=== modified file 'tests/Makefile.am'
--- a/tests/Makefile.am 2012-07-09 13:10:07 +0000
+++ b/tests/Makefile.am 2012-07-10 09:57:24 +0000
@@ -33,6 +33,7 @@ EXTRA_DIST = auto_increment.res auto_in
grant.pl grant.res test_delayed_insert.pl \
pmail.pl mail_to_db.pl table_types.pl \
myisam-big-rows.tst \
+ mysql_client_fw.c \
CMakeLists.txt
bin_PROGRAMS = mysql_client_test
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.1 branch (bjorn.munch:3769 to 3770) | Bjorn Munch | 10 Jul |