summaryrefslogtreecommitdiff
path: root/jstests/repl/repl15.js
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2012-02-12 15:48:32 -0800
committerAaron <aaron@10gen.com>2012-02-12 15:48:32 -0800
commit921c3d74f30927ff49261cf79266fbbc9f37901a (patch)
tree41b5fdfd9ca099a982855ba7c8aeb3396115a11c /jstests/repl/repl15.js
parent408bdeb3ca7e820e2ac1c32454e21e65cbdf9179 (diff)
downloadmongo-921c3d74f30927ff49261cf79266fbbc9f37901a.tar.gz
SERVER-4939 test
Diffstat (limited to 'jstests/repl/repl15.js')
-rw-r--r--jstests/repl/repl15.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/jstests/repl/repl15.js b/jstests/repl/repl15.js
new file mode 100644
index 00000000000..2545ec0b9d5
--- /dev/null
+++ b/jstests/repl/repl15.js
@@ -0,0 +1,39 @@
+// Test a case were an update can grow a document on master but growth is prevented on slave.
+// SERVER-4939
+
+if ( 0 ) { // SERVER-4939
+
+function doTest( capped ) {
+
+ rt = new ReplTest( "repl15tests" );
+ master = rt.start( true );
+ if ( capped ) {
+ master.getDB( 'd' ).createCollection( 'c', { capped:true, size:5*1024 } );
+ }
+ mc = master.getDB( 'd' )[ 'c' ];
+
+ big = new Array( 1000 ).toString();
+ // Insert a document, then make it slightly smaller.
+ mc.insert( {a:big} );
+ mc.update( {}, {$set:{a:'b'}} );
+
+ slave = rt.start( false );
+ sc = slave.getDB( 'd' )[ 'c' ];
+
+ // Slave will copy the smaller doc.
+ assert.soon( function() { return sc.count( {a:'b'} ) > 0; } );
+
+ // Update the primary doc to its original size.
+ mc.update( {}, {$set:{a:big}} );
+
+ // Wait for secondary to clone the update.
+ assert.soon( function() { return sc.count( {a:big} ) > 0; } );
+
+ rt.stop();
+
+}
+
+doTest( false );
+doTest( true );
+
+}