Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-19014

RecordStore->restore() return value is often unused

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Trivial - P5 Trivial - P5
    • None
    • Affects Version/s: 3.1.4
    • Component/s: Storage
    • Storage NYC 2018-07-02, Storage NYC 2018-07-16, Storage NYC 2018-07-30, Storage NYC 2018-08-13

      Coverity is complaining about multiple places in our code where we do not check the return value of RecordStore.restore()

              /**
               * Recovers from potential state changes in underlying data.
               *
               * Returns false if it is invalid to continue using this iterator. This usually means that
               * capped deletes have caught up to the position of this iterator and continuing could
               * result in missed data.
               *
               * If the former position no longer exists, but it is safe to continue iterating, the
               * following call to next() will return the next closest position in the direction of the
               * scan, if any.
               *
               * This handles restoring after either savePositioned() or saveUnpositioned().
               */
              virtual bool restore(OperationContext* txn) = 0;
      

      It looks like all of the cases where we do this are safe and do not need to deal with the capped collections edge case. However, this is probably an indication that the API for RecordStore could be improved--it's a bit odd to have a return value that we throw away most of the time.

            Assignee:
            audrey.fang Audrey Fang (Inactive)
            Reporter:
            kyle.erf Kyle Erf
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: