[SERVER-14602] Update records document but not indexed values due to index error Created: 17/Jul/14  Updated: 10/Dec/14  Resolved: 17/Jul/14

Status: Closed
Project: Core Server
Component/s: Index Maintenance, Write Ops
Affects Version/s: 2.7.3
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Randolph Tan Assignee: hari.khalsa@10gen.com
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-14431 Invalid chunk data after splitting on... Closed
Operating System: ALL
Steps To Reproduce:

> db.user.ensureIndex({ x: 1 })
{ "ok" : 1 }
> db.user.insert({ a: 1, x: 1 })
WriteResult({ "nInserted" : 1 })
> var large = new Array(1030).join('x');
> db.user.find()
{ "_id" : ObjectId("53c810eec2397139e0b33511"), "a" : 1, "x" : 1 }
> db.user.update({ a: 1 }, { $set: { x: large }})
WriteResult({
	"nMatched" : 0,
	"nUpserted" : 0,
	"writeError" : {
		"code" : undefined,
		"errmsg" : "Btree::insert: key too large to index, failing test.user.$x_1 1042 { : \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...\" }"
	}
})
> db.user.find()
{ "_id" : ObjectId("53c810eec2397139e0b33511"), "a" : 1, "x" : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }
> db.user.find().hint({ x: 1 })
> db.user.find().hint({ x: 1 }).explain()
{
	"cursor" : "BtreeCursor x_1",
	"isMultiKey" : false,
	"n" : 0,
	"nscannedObjects" : 0,
	"nscanned" : 0,
	"nscannedObjectsAllPlans" : 0,
	"nscannedAllPlans" : 0,
	"scanAndOrder" : false,
	"indexOnly" : false,
	"nYields" : 0,
	"nChunkSkips" : 0,
	"millis" : 0,
	"indexBounds" : {
		"x" : [
			[
				{
					"$minElement" : 1
				},
				{
					"$maxElement" : 1
				}
			]
		]
	},
	"server" : "ren-desktop:27017",
	"filterSet" : false
}

Participants:

 Description   

It is possible for the update operation to successfully modify a document, but fail to update the indexes. This would make the document invisible when the affected index is used to perform a query.



 Comments   
Comment by Randolph Tan [ 21/Jul/14 ]

schwerin I can reproduce the bug with just the legacy writes (without using apply ops) in v2.4.9.

Comment by Andy Schwerin [ 18/Jul/14 ]

I believe this may be because the _applyOps command continues on failures. The problem seems likely to exist in 2.4, also. Can you confirm, Randolph?

Comment by Randolph Tan [ 18/Jul/14 ]

hari.khalsa@10gen.com Interestingly I can't reproduce this using the normal write command path, but I can reproduce it with the procedure on the ticket, which indirectly uses applyOps to perform the update.

Comment by hari.khalsa@10gen.com [ 18/Jul/14 ]

renctan Does this repro on 2.6.x? The motivating ticket is marked 2.6.x...

Comment by Eliot Horowitz (Inactive) [ 17/Jul/14 ]

SERVER-13951 assuming 2.7 only

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