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

Allow cursor registration without a PlanExecutor

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major - P3 Major - P3
    • None
    • 3.1.9
    • Querying
    • Query
    • ALL

    Description

      Currently, a ClientCursor cannot be established without first constructing a PlanExecutor. In a sharded environment, a registered cursor is what prevents the RangeDeleter from deleting migrated documents. A PlanExecutor is allowed to yield during planning, which releases the locks on the collection while yielded. This can lead to the following scenario:

      1. Acquire locks and construct a PlanExecutor.
      2. During construction of a PlanExecutor, the planning machinery yields.
      3. A chunk migration finishes during the yield, where this shard is the donor shard.

      Since we have not yet established a ClientCursor, the RangeDeleter is now allowed to delete documents from this chunk, even though the ShardFilterStage thinks that they are owned by this shard. Thus it is possible to miss matching documents.

      It should be possible to register a cursor before constructing a PlanExecutor, to prevent this scenario. Note this is not a problem for the find command (it makes a special check to ensure that the shard version hasn't changed during PlanExecutor construction), but it is for other callers of getExecutor, such as the aggregation framework.

      Attachments

        Activity

          People

            backlog-server-query Backlog - Query Team (Inactive)
            charlie.swanson@mongodb.com Charlie Swanson
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: