File: repl15.js

package info (click to toggle)
mongodb 1%3A2.4.10-5
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 82,464 kB
  • sloc: cpp: 740,225; ansic: 152,098; sh: 13,820; python: 11,864; makefile: 1,012; perl: 922; pascal: 617; java: 452; lisp: 222; asm: 174
file content (39 lines) | stat: -rw-r--r-- 985 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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 );

}