-
Type: Bug
-
Resolution: Done
-
Priority: Critical - P2
-
Affects Version/s: 3.1.9
-
Component/s: Replication
-
Fully Compatible
-
ALL
-
-
Query 12 (04/04/16)
-
(copied to CRM)
-
0
.
ISSUE SUMMARY
On MongoDB 3.2, collections created using the $out operator in the aggregation pipeline are incorrectly marked as temporary collections.
In a replica set, when an election takes place, all temporary collections are removed from the dataset.
USER IMPACT
All collections created with MongoDB 3.2 via an aggregation pipeline are removed if there's an election on a replica set.
These collections must be re-created by re-running the aggregation pipeline used to create them originally. To prevent them from being dropped again please see the WORKAROUNDS section below or upgrade to MongoDB 3.2.5.
WORKAROUNDS
After an aggregation command has successfully finished and created a collection (e.g.: agg_out), users can rename the collection with the renameCollection command to avoid running into this issue:
use admin db.runCommand( { renameCollection: "dbname.created_with_$out", to: "dbname.some_other_name" } )
Upon renaming the collection, its temporary flag is cleared, so a future replica set election will not drop the collection. Note that it's easy to restore the required name by executing another renameCollection command.
AFFECTED VERSIONS
Only collections created in MongoDB 3.2 via the $out operator from the aggregation pipeline are affected by this issue.
Collections created using earlier versions of MongoDB that are now hosted on a MongoDB 3.2 replica set are not affected by this issue.
FIX VERSION
The fix is included in the 3.2.5 production release.
Original description
Any collection created using an aggregate operation will be dropped when the resultset steps down.
I thought it was todo with lookup, but after removing that pipe, I find that it is all aggregations.
- is related to
-
SERVER-23514 Remove code and tests from SERVER-23299
- Closed
- related to
-
SERVER-23299 Remove temp flag on all collections if last startup was on 3.2.0-3.2.4
- Closed