[SERVER-38968] 2 identical objectids Created: 13/Jan/19  Updated: 23/Jan/19  Resolved: 23/Jan/19

Status: Closed
Project: Core Server
Component/s: Index Maintenance, Storage
Affects Version/s: 3.2.3
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: liuhuancom Assignee: Eric Sedor
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: JPEG File mmexport1547354844702.jpg     JPEG File mmexport1547354846886.jpg     JPEG File mmexport1547354848416.jpg    
Issue Links:
Duplicate
is duplicated by SERVER-38967 2个一样的objectid Closed
Operating System: ALL
Participants:

 Description   

We are using 3.2.3
The problem we encountered was that a piece of data in the database could not be found with _id, it could be found with find uid, and it was also possible to insert a data of the same _id into the database.

With attachment



 Comments   
Comment by Eric Sedor [ 22/Jan/19 ]

Thank you for clarifying. Because MongoDB 3.2 reached end of life in September 2018, we aren't going to be able to work this issue directly. We recommend updating to the most recent version when you can, and let us know if you notice any issues with a supported version.

For now, based on the additional information you provided, we recommend making a copy of this node's data files to work off of, and make a copy of the document that is not findable by _id. Then, delete the document that is not findable by _id by using an indexed query that uniquely identifies the document, and re-insert it with a new _id.

Comment by liuhuancom [ 22/Jan/19 ]

1 Mongodb 3.2.3 WiredTiger

2 no sharded

3 Created time 2019-01-07 07:43:26 No maintenance, As usual

// collection: email
{
	"_id" : ObjectId("5c32929e23c8f21404a6a76a"),
	"uid" : "2720_5c0b7e0623c8f228d076c140",
	"title" : "公会探宝BOSS奖励",
	"getprize" : 0,
	"content" : "恭喜你的探宝BOSS被成功击杀,这是您的奖励",
	"ttltime" : ISODate("2019-01-07T15:43:26.192+08:00"),
	"isread" : 0,
	"etype" : 1,
	"passtime" : 1548114206,
	"prize" : [
		{
		"a" : "attr",
		"t" : "rmbmoney",
		"n" : 160
	}
	],
	"ctime" : 1546818206
}

4

> db
zhengba_s2720
> db.email.getIndexes();
[
	{
		"v" : 1,
		"key" : {
			"_id" : 1
		},
		"name" : "_id_",
		"ns" : "zhengba_s2720.email"
	},
	{
		"v" : 1,
		"key" : {
			"uid" : 1,
			"etype" : 1
		},
		"name" : "uid_1_etype_1",
		"ns" : "zhengba_s2720.email"
	},
	{
		"v" : 1,
		"key" : {
			"ttltime" : 1
		},
		"name" : "ttltime_1",
		"ns" : "zhengba_s2720.email",
		"expireAfterSeconds" : 1296000
	}
]

5

> db.printReplicationInfo();
{ "errmsg" : "neither master/slave nor replica set replication detected" }
> 

6

One can find one with _id, the second one is that we copy the first data insert.

7

I don’t know why, I don’t dare to delete it.

8

Nothing found yet

Comment by Eric Sedor [ 14/Jan/19 ]

Hello,

We would like to ask for some additional information to help us narrow down possibilities and guide an investigation:

  1. What storage engine is the database using? (e.g., WiredTiger, MMAPv1?)
  2. Is this a sharded cluster and is the email collection sharded? If so, can you provide the shard key?
  3. This ObjectId looks to have been generated on ISODate("2019-01-06T23:43:26Z"), does that seem right? Can you provide information about any maintenance that occurred since the 6th of January? (e.g., version change, storage engine change?)
  4. Can you provide the full output of db.email.getIndexes()?
  5. Can you provide the output of db.printReplicationInfo()? The "log length start to end" number in hours will help us determine if information about what happened might still be available in the oplog. If this looks plausible we suggest taking a backup of the oplog as soon as possible, with a command like: mongodump --db local --collection "oplog.rs". If you are able to obtain this, let us know and we can provide a secure upload location.
  6. Does mmexport1547354844702.jpg show two documents not returnable by _id, or is it the state after inserting a document with the same _id as one document that would not be returned?
  7. Have you resolved this specific issue with _id: ObjectId("5c32929e23c8f21404a6a76a") by removing a copy of the document or is the duplication still present?
  8. Are there other _ids with this issue, and/or are other cases of this duplication still happening?

Please also let us know if we can clarify any of our questions.

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