[SERVER-69704] Remove unused StatusWith::andThen, StatusWith::transform Created: 14/Sep/22  Updated: 29/Oct/23  Resolved: 30/Sep/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.2.0-rc0

Type: Improvement Priority: Major - P3
Reporter: Billy Donahue Assignee: Billy Donahue
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-69675 Simplify window_function_exec_linear_... Closed
Problem/Incident
is caused by SERVER-47327 Add composition member functions to S... Closed
Backwards Compatibility: Fully Compatible
Sprint: Service Arch 2022-10-03, Service Arch 2022-10-17
Participants:

 Description   

These are unused and make up the majority of StatusWith's implementation in terms of LoC, and a vast majority of its unit test is dedicated to testing these.

andThen is used in one place but that place would be much better off without it.
So this ticket depends on the removal of that caller in SERVER-69675.



 Comments   
Comment by Githook User [ 30/Sep/22 ]

Author:

{'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}

Message: SERVER-69704 remove unused StatusWith::andThen, StatusWith::transform
Branch: master
https://github.com/mongodb/mongo/commit/95c8560bb1e413499527570fd6b4ab0cc542668a

Comment by Githook User [ 30/Sep/22 ]

Author:

{'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}

Message: SERVER-69704 clean up one recent use of .transform
Branch: master
https://github.com/mongodb/mongo/commit/d04ce74fae19b2b02af63a6ac2a669f37426658b

Comment by Billy Donahue [ 29/Sep/22 ]

thanks!

Comment by Jacob Evans [ 29/Sep/22 ]

Sure, go ahead and remove them.

Comment by Billy Donahue [ 29/Sep/22 ]

jacob.evans@mongodb.com after 3 years these functions are unused. They represent about half of the bulk of the StatusWith class definition so they're making its API harder to navigate. The tests are also pretty intense.

There was one use (SERVER-69675) but it was not a great example and was much better off after being rewritten to use exceptions.

I would be interested in knowing whether there are places where these could be used but just haven't had the uptake.
I would also be interested in thinking about whether, if they're needed, they could be expressed as nonmember functions outside the class?

Would you object to removing them?

Comment by Billy Donahue [ 14/Sep/22 ]

PoC https://github.com/10gen/mongo/pull/7559

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