diff options
author | unknown <tsmith/tim@siva.hindu.god> | 2006-09-14 23:19:24 -0600 |
---|---|---|
committer | unknown <tsmith/tim@siva.hindu.god> | 2006-09-14 23:19:24 -0600 |
commit | d7a1f97c15fc5adaaf3116b8fb9ee32783498165 (patch) | |
tree | dd6fccf50a67ceee15c758d3bd103902956a4058 /mysys/my_quick.c | |
parent | 89c7db0cb0a67a8c7bd30eb4043ec948554244e9 (diff) | |
download | mariadb-git-d7a1f97c15fc5adaaf3116b8fb9ee32783498165.tar.gz |
Bug #4053: too many of "error 1236: 'binlog truncated in the middle of event' from master"
- Fix my_read/my_write to handle return values from read/write correctly
- Add debugging 'deprecated function' warning to my_lread/my_lwrite
- Add debugging 'error, read/write interrupt not handled' warning to my_quick_read/my_quick_write
There is no test case associated with these changes. However, this is a conservative change,
and no repeatable test case is available.
mysys/my_lread.c:
Warn about using deprecated function.
mysys/my_lwrite.c:
Warn about using deprecated function.
mysys/my_pread.c:
Handle interrupted read() or write() (EINTR) properly
mysys/my_quick.c:
Warn about interrupted read() or write(), which is not
handled by my_quick_read() or my_quick_write().
mysys/my_read.c:
Handle interrupted read() (EINTR) properly
mysys/my_write.c:
Handle interrupted write() (EINTR) properly
Diffstat (limited to 'mysys/my_quick.c')
-rw-r--r-- | mysys/my_quick.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/mysys/my_quick.c b/mysys/my_quick.c index 44ed3fc0b2c..ffc8160c371 100644 --- a/mysys/my_quick.c +++ b/mysys/my_quick.c @@ -26,6 +26,14 @@ uint my_quick_read(File Filedes,byte *Buffer,uint Count,myf MyFlags) if ((readbytes = (uint) read(Filedes, Buffer, Count)) != Count) { +#ifndef DBUG_OFF + if ((readbytes == 0 || (int) readbytes == -1) && errno == EINTR) + { + DBUG_PRINT("error", ("my_quick_read() was interrupted and returned %d" + ". This function does not retry the read!", + (int) readbytes)); + } +#endif my_errno=errno; return readbytes; } @@ -35,8 +43,24 @@ uint my_quick_read(File Filedes,byte *Buffer,uint Count,myf MyFlags) uint my_quick_write(File Filedes,const byte *Buffer,uint Count) { - if ((uint) write(Filedes,Buffer,Count) != Count) +#ifndef DBUG_OFF + uint writtenbytes; +#endif + + if (( +#ifndef DBUG_OFF + writtenbytes = +#endif + (uint) write(Filedes,Buffer,Count)) != Count) { +#ifndef DBUG_OFF + if ((writtenbytes == 0 || (int) writtenbytes == -1) && errno == EINTR) + { + DBUG_PRINT("error", ("my_quick_write() was interrupted and returned %d" + ". This function does not retry the write!", + (int) writtenbytes)); + } +#endif my_errno=errno; return (uint) -1; } |