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

Have WT grouped collections support random cursors

    • Type: Icon: New Feature New Feature
    • Resolution: Won't Do
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Storage
    • Labels:
      None
    • Storage Execution

      With multiple MongoDB collections grouped inside a single WT table, WT's random cursor configuration has no way to tell it's returning a document that belongs to the collection queried.

      https://github.com/mongodb/mongo/blob/bd678a44e7b087753024b27b2a75a465e00c7b89/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp#L639

      Grouping collections into WT tables will not mix with the existing random cursor implementation (passing "next_random" to the cursor config). Current options (disregarding feasibility) include:

      • Leave the RandomCursor method unimplemented for grouped record stores. The query layer has a default walking implementation.
      • Make calls to WT with a "next_random" cursor. This can return a document that does not belong to the collection. Repeat calls until a valid document is returned.
      • Add work to WT that allows a random cursor to respect a range of keys to select from.

      A hybrid of the first two may cover most use cases. When the collection to sample is small, the overhead of a walking cursor is small. When a collection is large (relative to the entire table), sampling random documents from the table will often return one belonging to the collection of interest. Large collections that are small relative to the table is a use-case not particularly suited to grouped collections.

            Assignee:
            backlog-server-execution [DO NOT USE] Backlog - Storage Execution Team
            Reporter:
            daniel.gottlieb@mongodb.com Daniel Gottlieb (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: