Skip to content

Commit 0db50be

Browse files
committed
Fix logic around retrying failed Windows async IO as synchronous IO . os_file_write/read macros were wrong (had wrong number of args), among other things
1 parent f0da062 commit 0db50be

File tree

1 file changed

+6
-34
lines changed

1 file changed

+6
-34
lines changed

storage/xtradb/os/os0file.cc

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1598,7 +1598,7 @@ UNIV_INTERN
15981598
void
15991599
os_file_set_nocache(
16001600
/*================*/
1601-
int fd /*!< in: file descriptor to alter */
1601+
os_file_t fd /*!< in: file descriptor to alter */
16021602
__attribute__((unused)),
16031603
const char* file_name /*!< in: used in the diagnostic
16041604
message */
@@ -5041,53 +5041,25 @@ os_aio_windows_handle(
50415041
}
50425042

50435043
if (retry) {
5044-
/* retry failed read/write operation synchronously.
5045-
No need to hold array->mutex. */
5046-
5047-
#ifdef UNIV_PFS_IO
5048-
/* This read/write does not go through os_file_read
5049-
and os_file_write APIs, need to register with
5050-
performance schema explicitly here. */
5051-
struct PSI_file_locker* locker = NULL;
5052-
register_pfs_file_io_begin(locker, slot->file, slot->len,
5053-
(slot->type == OS_FILE_WRITE)
5054-
? PSI_FILE_WRITE
5055-
: PSI_FILE_READ,
5056-
__FILE__, __LINE__);
5057-
#endif
5044+
LARGE_INTEGER li;
5045+
li.LowPart = slot->control.Offset;
5046+
li.HighPart = slot->control.OffsetHigh;
50585047

50595048
ut_a((slot->len & 0xFFFFFFFFUL) == slot->len);
50605049

50615050
switch (slot->type) {
50625051
case OS_FILE_WRITE:
50635052
ret_val = os_file_write(slot->name, slot->file, slot->buf,
5064-
slot->control.Offset, slot->control.OffsetHigh, slot->len);
5053+
li.QuadPart, slot->len);
50655054
break;
50665055
case OS_FILE_READ:
50675056
ret_val = os_file_read(slot->file, slot->buf,
5068-
slot->control.Offset, slot->control.OffsetHigh, slot->len);
5057+
li.QuadPart, slot->len);
50695058
break;
50705059
default:
50715060
ut_error;
50725061
}
50735062

5074-
#ifdef UNIV_PFS_IO
5075-
register_pfs_file_io_end(locker, len);
5076-
#endif
5077-
5078-
if (!ret && GetLastError() == ERROR_IO_PENDING) {
5079-
/* aio was queued successfully!
5080-
We want a synchronous i/o operation on a
5081-
file where we also use async i/o: in Windows
5082-
we must use the same wait mechanism as for
5083-
async i/o */
5084-
5085-
ret = GetOverlappedResult(slot->file,
5086-
&(slot->control),
5087-
&len, TRUE);
5088-
}
5089-
5090-
ret_val = ret && len == slot->len;
50915063
}
50925064

50935065
os_aio_array_free_slot((os_aio_array_t *)slot->arr, slot);

0 commit comments

Comments
 (0)