[SERVER-10518] repl writer worker can't have undefined in a query expression Created: 15/Aug/13  Updated: 11/Jul/16  Resolved: 26/Aug/13

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: 2.4.3
Fix Version/s: 2.5.3

Type: Bug Priority: Major - P3
Reporter: Steffen Assignee: Matt Dannenberg
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 12.04.1 LTS Linux 3.2.0-32-generic #51-Ubuntu SMP Wed Sep 26 21:33:09 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux


Attachments: Text File Mongo_error.log    
Issue Links:
Depends
is depended on by DOCS-1922 Document: repl writer worker can't ha... Closed
Backwards Compatibility: Minor Change
Operating System: ALL
Participants:

 Description   

MongoDB secondaries crash if master succeeds to add a document with _id set to undefined.

Document is :

{ _id: undefined, migrated: new Date(1376502667931) }

Master successfull adds this document, writes it to the oplog.
All secondaries try to read oplog and fail everytime (restart).

See attachment for error output.



 Comments   
Comment by Alexey Zhuchkov [ 25/Jun/14 ]

Perhaps it makes sense to skip oplog operations with _id undefined in repl writer to avoid secondaries crash?

Comment by Alexey Zhuchkov [ 25/Jun/14 ]

Removing such document if it already exists also cause secondaries to crash with same error on latest server version (mongodb 2.6.3).

Comment by auto [ 28/Sep/13 ]

Author:

{u'username': u'scotthernandez', u'name': u'Scott Hernandez', u'email': u'scotthernandez@gmail.com'}

Message: SERVER-10518: disallow _id field arrays and undefined
Branch: master
https://github.com/mongodb/mongo/commit/68b9892772fc012dc4d15bef8deb19bc2af8cdaf

Comment by auto [ 28/Aug/13 ]

Author:

{u'username': u'dannenberg', u'name': u'matt dannenberg', u'email': u'matt.dannenberg@10gen.com'}

Message: SERVER-10518 adding test
Branch: master
https://github.com/mongodb/mongo/commit/04fce192cd8a768209ed8b59ae409de0aa786b6b

Comment by Matt Dannenberg [ 26/Aug/13 ]

Turns out the capped collections issue isn't an issue and the test I saw fail was already failing.

inb4, triple revert

Comment by auto [ 26/Aug/13 ]

Author:

{u'username': u'dannenberg', u'name': u'matt dannenberg', u'email': u'matt.dannenberg@10gen.com'}

Message: reapply "SERVER-10518 do not allow storage of objects with an undefined _id"

This reverts commit d0502e5bd74203d50ce5b4c8341de3ed01c6c508.
Branch: master
https://github.com/mongodb/mongo/commit/36f80f77a3370d858ac203035da8e4c29039f1b4

Comment by Matt Dannenberg [ 26/Aug/13 ]

_id: undefined is the case in capped collections, hence the revert and reopening of this issue

Comment by auto [ 26/Aug/13 ]

Author:

{u'username': u'dannenberg', u'name': u'matt dannenberg', u'email': u'matt.dannenberg@10gen.com'}

Message: Revert "SERVER-10518 do not allow storage of objects with an undefined _id"

This reverts commit 27c3e7ede4c8d0e8b7e29ad46d010a276eb0aec6.
Branch: master
https://github.com/mongodb/mongo/commit/d0502e5bd74203d50ce5b4c8341de3ed01c6c508

Comment by auto [ 26/Aug/13 ]

Author:

{u'username': u'dannenberg', u'name': u'matt dannenberg', u'email': u'matt.dannenberg@10gen.com'}

Message: SERVER-10518 do not allow storage of objects with an undefined _id
Branch: master
https://github.com/mongodb/mongo/commit/27c3e7ede4c8d0e8b7e29ad46d010a276eb0aec6

Comment by Matt Dannenberg [ 21/Aug/13 ]

Great. Glad to hear it. Sorry for the trouble.

Comment by Steffen [ 21/Aug/13 ]

We did a full resync of the secondaries.

Comment by Matt Dannenberg [ 16/Aug/13 ]

We shouldn't be allowing the storage of any documents with an undefined _id. I have a fix for this in the works, it is scheduled to be in the 2.6 release.

In the meantime, you can resync your secondaries from the primary either from scratch or using a copy of the primary's data files. Details are available on our Resync a Member of a Replica Set page.

Comment by Steffen [ 16/Aug/13 ]

MongoDB Version 2.4.3
Replicaset with 3 Nodes (1 hidden) and 1 arbiter.

Comment by Steffen [ 15/Aug/13 ]

We are doing a migration with javascript code running in the mongo shell.

Task: Copy a field value into _id.
Goal: remove this field and use _id instead.

We have a document with a field 'targetID : String'. This document get's removed and saved again with _id replaced by this string.
There was no check for empty or null. That's why it added this 'empty' document.

Comment by Matt Dannenberg [ 15/Aug/13 ]

I can't reproduce this. How did you get the document with _id:undefined into the database? What driver and version of mongod were you using?

Generated at Thu Feb 08 03:23:22 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.