[SERVER-26037] DocumentSourceCursor should report appropriate error on encountering a view Created: 09/Sep/16  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: James Wahlin Assignee: Backlog - Query Execution
Resolution: Unresolved Votes: 0
Labels: open_todo_in_code, read-only-views
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-22541 Aggregation plan executors should be ... Closed
is related to SERVER-25808 Test concurrent view modification for... Closed
Assigned Teams:
Query Execution
Participants:

 Description   

It is currently possible for DocumentSourceCursor to encounter a view namespace when acquiring a collection lock on what it expects to be a collection. When this occurs it uasserts with 'CommandNotSupportedOnView' which is the correct behavior but not the correct error. We should return a more appropriate error in this scenario which can be reach via the following sequence (and reproducible under an fsm test being written for SERVER-25808):

  1. A find is run against a view
  2. DB & collection locks are dropped for conversion of find to agg on the view
  3. The view is dropped
  4. The aggregation is then executed against the former view namespace (executing on the non-view path)
  5. Aggregation drops the DB & collection locks upon establishing a ClientCursor obj
  6. The view is recreated
  7. DocumentSourceCursor attempts to establish DB & collection locks with the understanding that the namespace is a collection. It uasserts with 'CommandNotSupportedOnView' when it finds that the namespace is a view.

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