Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-14115

MS: Fix the aio read/write error caused by wrong useage of lpNumberOfBytesWritten

    XMLWordPrintable

    Details

    • Sprint:
      10.3.3-1

      Description

      From 9fdb2929e289210bdc801aa714d72aff27ae20de Mon Sep 17 00:00:00 2001
      From: Suna Liu <sunl@microsoft.com>
      Date: Sat, 30 Sep 2017 02:11:16 +0000
      Subject: [PATCH] Merged PR 65296: Fix the aio read/write error caused by wrong
       useage of lpNumberOfBytesWritten
       
      Fix the aio read/write error caused by wrong useage of lpNumberOfBytesWritten
       
      Related work items: #81926
      ---
       storage/innobase/os/os0file.cc | 11 ++++++++---
       1 file changed, 8 insertions(+), 3 deletions(-)
       
      diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
      index 8113a34998a..126462f3c91 100644
      --- a/storage/innobase/os/os0file.cc
      +++ b/storage/innobase/os/os0file.cc
      @@ -7505,7 +7505,7 @@ try_again:
       #ifdef WIN_ASYNC_IO
                              ret = ReadFile(
                                      file.m_file, slot->ptr, slot->len,
      -                               &slot->n_bytes, &slot->control);
      +                               NULL, &slot->control);
       #elif defined(LINUX_NATIVE_AIO)
                              if (!array->linux_dispatch(slot)) {
                                      goto err_exit;
      @@ -7523,7 +7523,7 @@ try_again:
       #ifdef WIN_ASYNC_IO
                              ret = WriteFile(
                                      file.m_file, slot->ptr, slot->len,
      -                               &slot->n_bytes, &slot->control);
      +                               NULL, &slot->control);
       #elif defined(LINUX_NATIVE_AIO)
                              if (!array->linux_dispatch(slot)) {
                                      goto err_exit;
      @@ -7540,7 +7540,9 @@ try_again:
       
       #ifdef WIN_ASYNC_IO
              if (srv_use_native_aio) {
      -               if ((ret && slot->len == slot->n_bytes)
      +               if ((ret
      +                     && GetOverlappedResult(file.m_file, &slot->control, &slot->n_bytes, TRUE)
      +                     && slot->len == slot->n_bytes)
                           || (!ret && GetLastError() == ERROR_IO_PENDING)) {
                              /* aio was queued successfully! */
       
      @@ -7591,6 +7593,9 @@ err_exit:
                      << ", bytes=" << n
                      << ", read_only=" << read_only
                      << " - slot_len=" << slot->len << ", slot_nbytes=" << slot->n_bytes
      +#ifdef WIN_ASYNC_IO
      +               << ", slot_control_InternalHigh=" << slot->control.InternalHigh
      +#endif
                      << " - ret=" << ret << ", last_err=" << GetLastError();
       
              array->release_with_mutex(slot);
      

        Attachments

          Activity

            People

            Assignee:
            wlad Vladislav Vaintroub
            Reporter:
            svoj Sergey Vojtovich
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: