summaryrefslogtreecommitdiff
path: root/jstests/repl
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2012-01-25 20:55:25 -0800
committerAaron <aaron@10gen.com>2012-02-06 22:12:26 -0800
commit5750a5b7a1b7bb5ae495534f9228d5773c28db4b (patch)
tree3806748358de30ad21e1bca1acb13afac84a3cf3 /jstests/repl
parent4ad6e3c6b0e08a877cccf476ffa0c7fa694c2452 (diff)
downloadmongo-5750a5b7a1b7bb5ae495534f9228d5773c28db4b.tar.gz
SERVER-4781 tests
Diffstat (limited to 'jstests/repl')
-rw-r--r--jstests/repl/repl13.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/jstests/repl/repl13.js b/jstests/repl/repl13.js
new file mode 100644
index 00000000000..403effeb846
--- /dev/null
+++ b/jstests/repl/repl13.js
@@ -0,0 +1,28 @@
+// Test update modifier uassert during initial sync. SERVER-4781
+
+rt = new ReplTest( "repl13tests" );
+
+m = rt.start( true );
+mc = m.getDB( 'd' )[ 'c' ];
+
+for( i = 0; i < 100000; ++i ) {
+ mc.save( {_id:i,a:{}} );
+}
+m.getDB( 'd' ).getLastError();
+
+s = rt.start( false );
+sc = s.getDB( 'd' )[ 'c' ];
+
+assert.soon( function() { printjson( sc.count() ); return sc.count() > 0; } );
+
+for( i = 99999; i >= 90000; --i ) {
+ // If the document is cloned as {a:1}, the {$set:{'a.b':1}} modifier will uassert.
+ mc.update( {_id:i}, {$set:{'a.b':1}} );
+ mc.update( {_id:i}, {$set:{a:1}} );
+}
+
+mc.save( {} )
+assert.soon( function() { return sc.count() == 100001; } );
+
+printjson( sc.findOne( {_id:99999} ) );
+printjson( sc.findOne( {_id:90000} ) );