Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-765

Seeking issues with GridFS file

    XMLWordPrintableJSON

Details

    • Fully Compatible

    Description

      There's two seek related issues with GridFS fixed by Pull Request https://github.com/mongodb/mongo-c-driver/pull/251/files

      1. If system tries to fetch a page with _mongoc_gridfs_file_refresh_page() not available in cursor anymore, it will fail doing so because comparison to detect the range of available pages had < and > signs reverse in this code (diff from PR):

      if (file->cursor &&

      • !(file->cursor_range[0] >= n && file->cursor_range[1] <= n)) {
        + !(file->cursor_range[0] <= n && file->cursor_range[1] >= n)) { mongoc_cursor_destroy (file->cursor); file->cursor = NULL; }

      2. When reading/writing into GridFSFile, if doing so exactly on blocks matching the chunk size, the proper chunk was not getting flushed to database because the calculation of chunk to flush overflowed into the next chunk because the pos field was pointing to the next byte to be written/read.

      The other diffs in the Pull Request try to address that issue by keeping track of "how" the pos field was updated:

      a. By direct seeking
      b. By movement to next byte by read or write operation

      Depending on this state, we calculate number of page to flush by subtracting 1 (or not) to current pos field.

      Attachments

        Activity

          People

            kyle.suarez@mongodb.com Kyle Suarez
            jsbattig@convey.com Jose Battig
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: