[SERVER-7371] Fix corner case where an update mod is applied twice Created: 16/Oct/12  Updated: 11/Jul/16  Resolved: 16/Oct/12

Status: Closed
Project: Core Server
Component/s: Write Ops
Affects Version/s: None
Fix Version/s: 2.2.1, 2.3.0

Type: Bug Priority: Major - P3
Reporter: Alberto Lerner Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-4781 replica set initial sync failure when... Closed
Operating System: ALL
Participants:

 Description   

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() );
            }
        };



 Comments   
Comment by auto [ 17/Oct/12 ]

Author:

{u'date': u'2012-10-16T18:40:02-07:00', u'email': u'alerner@10gen.com', u'name': u'Alberto Lerner'}

Message: SERVER-7371 Fix same corner case as the last one, but now when applied to secondary.
Branch: v2.2
https://github.com/mongodb/mongo/commit/43294fd78b4374530c219771f076aa8f2118ea23

Comment by auto [ 17/Oct/12 ]

Author:

{u'date': u'2012-10-16T14:27:30-07:00', u'email': u'alerner@10gen.com', u'name': u'Alberto Lerner'}

Message: SERVER-7371 Remove old comment.
Branch: v2.2
https://github.com/mongodb/mongo/commit/c26d366ca17b120f3bf3c538a44815d2a7acbf61

Comment by auto [ 17/Oct/12 ]

Author:

{u'date': u'2012-10-16T13:48:41-07:00', u'email': u'alerner@10gen.com', u'name': u'Alberto Lerner'}

Message: SERVER-7371 Fix corner case where an update mod is applied twice.
Branch: v2.2
https://github.com/mongodb/mongo/commit/9ff8d3a85f524d727edcb61d309e16656f8e9e7c

Comment by auto [ 17/Oct/12 ]

Author:

{u'date': u'2012-10-16T18:40:02-07:00', u'email': u'alerner@10gen.com', u'name': u'Alberto Lerner'}

Message: SERVER-7371 Fix same corner case as the last one, but now when applied to secondary.
Branch: master
https://github.com/mongodb/mongo/commit/0313d5e8e8b74fa76fcef3fba85ca376b33347f1

Comment by auto [ 16/Oct/12 ]

Author:

{u'date': u'2012-10-16T14:27:30-07:00', u'email': u'alerner@10gen.com', u'name': u'Alberto Lerner'}

Message: SERVER-7371 Remove old comment.
Branch: master
https://github.com/mongodb/mongo/commit/f2ebdd6197a417692a209db2691b540bc2235ced

Comment by auto [ 16/Oct/12 ]

Author:

{u'date': u'2012-10-16T13:48:41-07:00', u'email': u'alerner@10gen.com', u'name': u'Alberto Lerner'}

Message: SERVER-7371 Fix corner case where an update mod is applied twice.
Branch: master
https://github.com/mongodb/mongo/commit/0c1283f5c9fe3c32d194231934b99f3a7635e19c

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