Permalink
Browse files

SERVER-7186 Addressed idempotency violations in update operators.

  • Loading branch information...
1 parent edd2fa6 commit 57e654ee247b13a8a927e9f1f6da597c5ca33c0c Alberto Lerner committed Oct 5, 2012
@@ -102,21 +102,8 @@ namespace mongo {
DEV verify( mods->size() );
BSONObj pattern = patternOrig;
- if ( mss->haveArrayDepMod() ) {
- BSONObjBuilder patternBuilder;
- patternBuilder.appendElements( pattern );
- mss->appendSizeSpecForArrayDepMods( patternBuilder );
- pattern = patternBuilder.obj();
- }
-
- if( mss->needOpLogRewrite() ) {
- DEBUGUPDATE( "\t rewrite update: " << mss->getOpLogRewrite() );
- logOp("u", ns, mss->getOpLogRewrite() ,
- &pattern, 0, fromMigrate );
- }
- else {
- logOp("u", ns, updateobj, &pattern, 0, fromMigrate );
- }
+ DEBUGUPDATE( "\t rewrite update: " << mss->getOpLogRewrite() );
+ logOp("u", ns, mss->getOpLogRewrite() , &pattern, 0, fromMigrate );
}
return UpdateResult( 1 , 1 , 1 , BSONObj() );
} // end $operator update
@@ -336,13 +323,13 @@ namespace mongo {
const BSONObj& onDisk = loc.obj();
ModSet* useMods = mods.get();
- bool forceRewrite = false;
+ //bool forceRewrite = false;
auto_ptr<ModSet> mymodset;
if ( details.hasElemMatchKey() && mods->hasDynamicArray() ) {
useMods = mods->fixDynamicArray( details.elemMatchKey() );
mymodset.reset( useMods );
- forceRewrite = true;
+ //forceRewrite = true;
}
auto_ptr<ModSetState> mss = useMods->prepare( onDisk );
@@ -395,21 +382,8 @@ namespace mongo {
if ( logop ) {
DEV verify( mods->size() );
- if ( mss->haveArrayDepMod() ) {
- BSONObjBuilder patternBuilder;
- patternBuilder.appendElements( pattern );
- mss->appendSizeSpecForArrayDepMods( patternBuilder );
- pattern = patternBuilder.obj();
- }
-
- if ( forceRewrite || mss->needOpLogRewrite() ) {
- DEBUGUPDATE( "\t rewrite update: " << mss->getOpLogRewrite() );
- logOp("u", ns, mss->getOpLogRewrite() ,
- &pattern, 0, fromMigrate );
- }
- else {
- logOp("u", ns, updateobj, &pattern, 0, fromMigrate );
- }
+ DEBUGUPDATE( "\t rewrite update: " << mss->getOpLogRewrite() );
+ logOp("u", ns, mss->getOpLogRewrite() , &pattern, 0, fromMigrate );
}
numModded++;
if ( ! multi )
Oops, something went wrong.

0 comments on commit 57e654e

Please sign in to comment.