[SERVER-12625] Update w/no-op fields results in oplog entry for field Created: 05/Feb/14  Updated: 07/Mar/14  Resolved: 18/Feb/14

Status: Closed
Project: Core Server
Component/s: Write Ops
Affects Version/s: 2.5.5
Fix Version/s: 2.6.0-rc0

Type: Bug Priority: Major - P3
Reporter: Matt Dannenberg Assignee: Scott Hernandez (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Operating System: ALL
Participants:

 Description   

repro:
./mongod --replSet foo

in mongoshell:

> rs.initiate()
{
	"info2" : "no configuration explicitly specified -- making one",
	"me" : "dannenberg-air.local:27017",
	"info" : "Config now saved locally.  Should come online in about a minute.",
	"ok" : 1
}
foo:PRIMARY> db.foo.find()
{ "_id" : 1, "a" : 1, "b" : 31 }
{ "_id" : 2, "a" : 73, "b" : 481 }
{ "_id" : 3, "a" : 26, "b" : 974 }
foo:PRIMARY> db.foo.update({_id: {$gt:0}}, {$max:{'b':456}, $mul:{'a':3}}, {multi:true})
SingleWriteResult({
	"writeErrors" : [ ],
	"writeConcernErrors" : [ ],
	"nInserted" : 0,
	"nUpserted" : 0,
	"nUpdated" : 3,
	"nModified" : 3,
	"nRemoved" : 0,
	"upserted" : [ ]
})
foo:PRIMARY> db.foo.find()
{ "_id" : 1, "a" : 3, "b" : 456 }
{ "_id" : 2, "a" : 219, "b" : 481 }
{ "_id" : 3, "a" : 78, "b" : 974 }
foo:PRIMARY> use local
foo:PRIMARY> db.oplog.rs.find()
{ "ts" : Timestamp(1391619547, 1), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "o" : { "msg" : "initiating set" } }
{ "ts" : Timestamp(1391619586, 1), "h" : NumberLong("-9072134066425298927"), "v" : 2, "op" : "u", "ns" : "test.foo", "o2" : { "_id" : 1 }, "o" : { "$set" : { "b" : 456, "a" : 3 } } }
{ "ts" : Timestamp(1391619586, 2), "h" : NumberLong("4916804790102561797"), "v" : 2, "op" : "u", "ns" : "test.foo", "o2" : { "_id" : 2 }, "o" : { "$set" : { "b" : 456, "a" : 219 } } }
{ "ts" : Timestamp(1391619586, 3), "h" : NumberLong("1732897782215714738"), "v" : 2, "op" : "u", "ns" : "test.foo", "o2" : { "_id" : 3 }, "o" : { "$set" : { "b" : 456, "a" : 78 } } }

as you can see, the updates apply properly, but the oplog entries say to modify b even where it wasnt modified, which will lead to be bad info on the secondaries



 Comments   
Comment by Githook User [ 18/Feb/14 ]

Author:

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

Message: SERVER-12625: skip oplog entries for no-op fields
Branch: master
https://github.com/mongodb/mongo/commit/3042939e0f64bbb9076eef3ee1efcdd56fc02050

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