Commit 06ec56f5 authored by Sachin Agarwal's avatar Sachin Agarwal Committed by Marko Mäkelä

Bug #27850600 INNODB ASYNC IO ERROR HANDLING IN IO_EVENT

Problem:
io_getevents() - read asynchronous I/O events from the completion
queue. For each IO event, the res field in io_event tells whether IO
event is succeeded or not. To see if the IO actually succeeded we
always need to check event.res (negative=error,
positive=bytesread/written).
LinuxAIOHandler::collect() doesn't check event.res value for each event.
which leads to incorrect value in n_bytes for IO context (or IO Slot).

Fix:
Added a check for event.res negative value.

RB: 20871
Reviewed by : annamalai.gurusami@oracle.com
parent 4e9f8c9c
......@@ -1962,10 +1962,24 @@ LinuxAIOHandler::collect()
will be done in the calling function. */
m_array->acquire();
slot->ret = events[i].res2;
/* events[i].res2 should always be ZERO */
ut_ad(events[i].res2 == 0);
slot->io_already_done = true;
slot->n_bytes = events[i].res;
/*Even though events[i].res is an unsigned number
in libaio, it is used to return a negative value
(negated errno value) to indicate error and a positive
value to indicate number of bytes read or written. */
if (events[i].res > slot->len) {
/* failure */
slot->n_bytes = 0;
slot->ret = events[i].res;
} else {
/* success */
slot->n_bytes = events[i].res;
slot->ret = 0;
}
m_array->release();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment