summaryrefslogtreecommitdiff
path: root/mysys/my_read.c
diff options
context:
space:
mode:
authorSujatha Sivakumar <sujatha.sivakumar@oracle.com>2013-03-28 14:14:39 +0530
committerSujatha Sivakumar <sujatha.sivakumar@oracle.com>2013-03-28 14:14:39 +0530
commitd054027c4bfabdfa1cdbb58ee9aa34557eacbb45 (patch)
treece642fb92d15c30186ac36f364dd7c70ea141344 /mysys/my_read.c
parentf4b97d10a7ee6d2f9d05cbfd05360635329d452b (diff)
downloadmariadb-git-d054027c4bfabdfa1cdbb58ee9aa34557eacbb45.tar.gz
Bug#14324766:PARTIALLY WRITTEN INSERT STATEMENT IN BINLOG
NO ERRORS REPORTED Problem: ======= Errors from my_b_fill are ignored. MYSQL_BIN_LOG::write_cache code assumes that 0 returned from my_b_fill always means end-of-cache, but that is incorrect. It can result in error and the error is ignored. Other callers of my_b_fill don't check for error: my_b_copy_to_file, maybe my_b_gets. Fix: === An error handler is already present to check the "cache" error that is reported during "MYSQL_BIN_LOG::write_cache" call. Hence error handlers are added for "my_b_copy_to_file" and "my_b_gets". During my_b_fill() function call, when the cache read fails info->error= -1 is set. Hence a check for "info->error" is added for the above to callers upon their return. mysys/mf_iocache2.c: Added a check for "cache->error" and simulation of cache read failure mysys/my_read.c: Simulation of read failure sql/log_event.cc: Added debug simulation sql/sql_repl.cc: Added a check for cache error
Diffstat (limited to 'mysys/my_read.c')
-rw-r--r--mysys/my_read.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/mysys/my_read.c b/mysys/my_read.c
index 64f64872cb2..0f7a18220fe 100644
--- a/mysys/my_read.c
+++ b/mysys/my_read.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000-2002, 2004, 2006, 2007 MySQL AB
+/* Copyright (c) 2000-2002, 2004, 2006, 2007, 2013 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -44,8 +44,18 @@ size_t my_read(File Filedes, uchar *Buffer, size_t Count, myf MyFlags)
for (;;)
{
errno= 0; /* Linux doesn't reset this */
- if ((readbytes= read(Filedes, Buffer, (uint) Count)) != Count)
+ if (DBUG_EVALUATE_IF("simulate_file_read_error", 1, 0) ||
+ (readbytes= read(Filedes, Buffer, (uint) Count)) != Count)
{
+ DBUG_EXECUTE_IF ("simulate_file_read_error",
+ {
+ errno= ENOSPC;
+ readbytes= (size_t) -1;
+ DBUG_SET("-d,simulate_file_read_error");
+ DBUG_SET("-d,simulate_my_b_fill_error");
+ });
+
+
my_errno= errno ? errno : -1;
DBUG_PRINT("warning",("Read only %d bytes off %lu from %d, errno: %d",
(int) readbytes, (ulong) Count, Filedes,