jstests/sharding/conf_server_write_concern.js
/**
 * Test write concern with w parameter will not cause an error when writes to mongos
 * would trigger writes to config servers (in this test, split chunks is used).
 */
Test write concern with w parameter will not cause an error when writes to mongos
would trigger writes to config servers (in this test, split chunks is used).
Test write concern with w parameter will not cause an error when writes to mongos would trigger writes to config servers ( in this test split chunks is used ) .
function configTest(){
    var st = new ShardingTest({ shards: 1, rs: { oplogSize: 10 }, other: { chunkSize: 1 }});
    var mongos = st.s;
    var testDB = mongos.getDB( 'test' );
    var coll = testDB.user;
    testDB.adminCommand({ enableSharding: testDB.getName() });
    testDB.adminCommand({ shardCollection: coll.getFullName(), key: { x: 1 }});
    var chunkCount = function() {
        return mongos.getDB( 'config' ).chunks.find().count();
    };
    var initChunks = chunkCount();
    var currChunks = initChunks;
    var gleObj = null;
    var x = 0;
    while( currChunks <= initChunks ){
        assert.writeOK(coll.insert({ x: x++ }, { writeConcern: { w: 'majority' }}));
        currChunks = chunkCount();
    }
    st.stop();
}
function configTest ( ) { var st = new ShardingTest ( { shards : 1 , rs : { oplogSize : 10 } , other : { chunkSize : 1 } } ) ; var mongos = st . s ; var testDB = mongos . getDB ( 'test' ) ; var coll = testDB . user ; testDB . adminCommand ( { enableSharding : testDB . getName ( ) } ) ; testDB . adminCommand ( { shardCollection : coll . getFullName ( ) , key : { x : 1 } } ) ; var chunkCount = function ( ) { return mongos . getDB ( 'config' ) . chunks . find ( ) . count ( ) ; } ; var initChunks = chunkCount ( ) ; var currChunks = initChunks ; var gleObj = null ; var x = 0 ; while ( currChunks <= initChunks ) { assert . writeOK ( coll . insert ( { x : x ++ } , { writeConcern : { w : 'majority' } } ) ) ; currChunks = chunkCount ( ) ; } st . stop ( ) ; }
Test write concern with w parameter will not cause an error when writes to mongos
 would trigger writes to config servers (in this test, split chunks is used).
Test write concern with w parameter will not cause an error when writes to mongos would trigger writes to config servers ( in this test split chunks is used ) .