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

OplogStart finding code can return InternalError instead of a comprehensible error message

    XMLWordPrintable

    Details

      Description

      The OplogStart query execution stage was built as an MMAPv1-specific mechanism for quickly finding the start point for oplog scans. It is used for tailable oplog scans as well as for opening change streams. Since MMAPv1 storage engine support was removed during 4.1 development, the OplogStart code was also removed. Therefore, this issue only affects 4.0 and earlier branches.

      The OplogStart code path has a flaw in which it swallows the error returned by the PlanExecutor and instead returns an InternalError with message "quick oplog start location had error...?":

      https://github.com/mongodb/mongo/blob/3a5b4a17f2a3e148ab1e76cb205a8da636cd64f5/src/mongo/db/query/get_executor.cpp#L638-L641

      Instead, this code path should propagate the error message and error code from the underlying PlanExecutor. It should also add additional context to the error message string in order to indicate that the error occurred while using OplogStart to find the starting point for an oplog scan.

      Note that it is possible for this InternalError to leak to the client on systems configured to use storage engines other than MMAPv1, in particular systems using the WiredTiger storage engine. This is because we fall back to using the OplogStart stage when RecordStore::oplogStartHack() returns boost::none. The fact that we ever use the OplogStart stage on non-MMAPv1 systems is possibly undesirable, so we may wish to correct this behavior separately.

        Attachments

          Activity

            People

            Assignee:
            backlog-query-execution Backlog - Query Execution
            Reporter:
            david.storch David Storch
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated: