[SERVER-43821] Fail in query execution by throwing rather than the FAILURE state code Created: 03/Oct/19  Updated: 29/Oct/23  Resolved: 29/May/20

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

Type: Improvement Priority: Major - P3
Reporter: David Storch Assignee: David Storch
Resolution: Fixed Votes: 0
Labels: qexec-team
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
causes SERVER-74551 WriteConflictException unnecessarily ... Closed
Backwards Compatibility: Fully Compatible
Sprint: Query 2020-06-01, Query 2020-06-15
Participants:
Linked BF Score: 13

 Description   

If a PlanStage encounters a runtime failure, it currently is required to allocate a special WorkingSetMember representing a Status object and to return StageState::FAILURE. This forces all PlanStage implementations to be prepared to explicitly handle a FAILURE status from their children, which results in lots of boilerplate. It would be simpler to fail by throwing an exception, like we do if a query fails in DocumentSource execution code. This will also allow us to delete the undesirable code that packs a Status object into a Document.



 Comments   
Comment by Githook User [ 29/May/20 ]

Author:

{'name': 'David Storch', 'email': 'david.storch@mongodb.com', 'username': 'dstorch'}

Message: SERVER-43821 Make PlanStage and PlanExecutor return errors by throwing

This eliminates the need for the FAILURE status codes in
PlanStage and PlanExecutor, and brings query execution's
error reporting more in line with that of the rest of the
server. It also makes it easier for future implementations
of PlanExecutor to comply with the interface.
Branch: master
https://github.com/mongodb/mongo/commit/d295b6646fcc815e73ad3085b212ad14c8c6de01

Comment by Githook User [ 29/May/20 ]

Author:

{'name': 'David Storch', 'email': 'david.storch@mongodb.com', 'username': 'dstorch'}

Message: SERVER-43821 Make PlanStage and PlanExecutor return errors by throwing

This eliminates the need for the FAILURE status codes in
PlanStage and PlanExecutor, and brings query execution's
error reporting more in line with that of the rest of the
server. It also makes it easier for future implementations
of PlanExecutor to comply with the interface.
Branch: master
https://github.com/mongodb/mongo/commit/d295b6646fcc815e73ad3085b212ad14c8c6de01

Comment by David Storch [ 13/May/20 ]

I'm removing this ticket from the "Unify PlanStage and DocumentSource" epic, and assigning it to myself for a future sprint. As part of the SBE work, we will likely end up with a second implementation of the PlanExecutor interface. It would be nice to avoid forcing the SBE PlanExecutor to conform to the legacy engine's error reporting machinery.

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