[SERVER-40520] Avoid dropping temporary $out collection if everything succeeded Created: 08/Apr/19  Updated: 29/Oct/23  Resolved: 23/Apr/19

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

Type: Improvement Priority: Major - P3
Reporter: Charlie Swanson Assignee: Ian Boros
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Backwards Compatibility: Fully Compatible
Sprint: Query 2019-05-06
Participants:
Linked BF Score: 0

 Description   

It looks like ever since this commit we started unconditionally dropping the target collection when we're finished with $out mode "replaceCollection". Before this, we would only drop the temp namespace if the command didn't fully succeed since we reset _tempNS after finishing the inserts. Because all of this is happening within the DESTRUCTOR_GUARD, the exception is swallowed and there is no error reported back to the client. So there is no actual impact of this change, but we could probably gain back a little performance and sanity by avoiding dropping a non-existent collection at the end of every $out.



 Comments   
Comment by Githook User [ 23/Apr/19 ]

Author:

{'email': 'puppyofkosh@gmail.com', 'name': 'Ian Boros', 'username': 'puppyofkosh'}

Message: SERVER-40520 avoid dropping temp collection when $out succeeds
Branch: master
https://github.com/mongodb/mongo/commit/f419199b6b533258c4d6a5fd31684ef1fdb75cc3

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