Operational Defect Database

BugZero found this defect 68 days ago.

MongoDB | 2606165

MovePrimary creates collection on destination but doesn't copy documents / indexes

Last update date:

3/15/2024

Affected products:

MongoDB Server

Affected releases:

No affected releases provided.

Fixed releases:

No fixed releases provided.

Description:

Info

When the feature flag gTrackUnshardedCollectionsUponCreation is enabled, on movePrimary the call to get unsplittable collections catalogClient->getUnsplittableCollectionNamespacesForDb() returns all unsharded collections. This is added to the list of "tracked collections". However later on when we copy the DB over we create all the collections, but if the collection is a tracked collection we neither copy the indexes over nor copy the contents of the collection over either. Seen on base commit 64dca7eaed26da5ee7547e1d62be599a87678327

Top User Comments


Steps to Reproduce

Create a two shard cluster. Assuming database "test" lives on "shard-rs1" initially, connect to mongos, and then: // Create an unsharded collection mongos> db.mycoll.insert({a: 1}) // Move primary from the original home "shard-rs1" to "shard-rs0" mongos> db.adminCommand({movePrimary: 'test', to: 'shard-rs0'}) Now if you connect to shard-rs1 directly, you'll see that "test.mycoll" still exists on it.

Additional Resources / Links

Share:

BugZero® Risk Score

What's this?

Coming soon

Status

Closed

Learn More

Search:

...