[SERVER-29113] Have WT grouped collections support random cursors Created: 08/May/17  Updated: 06/Dec/22  Resolved: 09/Nov/20

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: Daniel Gottlieb (Inactive) Assignee: Backlog - Storage Execution Team
Resolution: Won't Do Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on WT-3341 Allow random cursor scan range to be ... Closed
Related
related to SERVER-28743 Make all WT cursor uses of keys --gro... Closed
Assigned Teams:
Storage Execution
Participants:

 Description   

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.



 Comments   
Comment by Daniel Gottlieb (Inactive) [ 25/May/17 ]

Heavy-lifting to be done in WT. This ticket will be for integrating into MongoDB.

Generated at Thu Feb 08 04:19:56 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.