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

my_b_seek() may not work correctly after my_b_read() hits EOF

    XMLWordPrintable

    Details

    • Sprint:
      10.0.26

      Description

      my_b_read() tries to read within a buffer where possible, and keeps track of the position of that buffer within the file when the buffer is refilled.

      However, if my_b_read() hits the end of the file, the operating system file pointer and the IO_CACHE pos_in_file may not be synchronised. A future call to my_b_seek() may not rectify this if the new position is within the buffer. At this point, further reads with my_b_read() would read from the buffer until it is empty, and then try to read from the end of the file. In essence, my_b_read() expects the OS file pointer to be at the end of the buffer (or info->seek_not_done to be set in order to trigger a seek to make this so).

      The attached patch fixes this by setting info->seek_not_done when my_b_read() hits EOF, causing future reads to seek to the correct position in the file.

        Attachments

          Activity

            People

            • Assignee:
              serg Sergei Golubchik
              Reporter:
              davidgow David Gow
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: