The bug can be triggered by adding this test to dbtests/updatetests.cpp
Uncomment DEBUGUPDATE in db/ops/update_internal.cpp and check that the second mod is being applied twice
class TwoNestedPulls { public: void run() { BSONObj obj = fromjson( "{ a:{ b:[ 1, 2 ], c:[ 1, 2 ]} }" ); BSONObj mod = fromjson( "{ $pull:{ 'a.b':2, 'a.c':2 }}" ); ModSet modSet( mod ); auto_ptr<ModSetState> modSetState = modSet.prepare(obj ); ASSERT_FALSE( modSetState->canApplyInPlace() ); modSetState->createNewFromMods(); // This is incorrectly logged as { $set:{ 'a.b':[ 1 ]}, $unset:{ 'a.c':1 } }. ASSERT_EQUALS( fromjson( "{ $set:{ 'a.b':[ 1 ] }, $set:{ 'a.c':[ 1 ] } }" ), modSetState->getOpLogRewrite() ); } };
- is related to
-
SERVER-4781 replica set initial sync failure when update cannot be applied to a future version of an object received via clone
- Closed