diff options
author | Randolph Tan <randolph@10gen.com> | 2014-04-02 11:02:08 -0400 |
---|---|---|
committer | Randolph Tan <randolph@10gen.com> | 2014-04-08 14:27:01 -0400 |
commit | f35da2d63ff53c494e02ac727399763081f1fcfd (patch) | |
tree | f31d589b2b5030cc90e1cb5561ed278414fbf1db /jstests/gle | |
parent | b4a2cc96b18cacdfece81215d9d8c7a3a84ba20a (diff) | |
download | mongo-f35da2d63ff53c494e02ac727399763081f1fcfd.tar.gz |
SERVER-13437 Cannot wait for write concern for createIndexes command on mongos
Diffstat (limited to 'jstests/gle')
-rw-r--r-- | jstests/gle/create_index_gle.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/jstests/gle/create_index_gle.js b/jstests/gle/create_index_gle.js new file mode 100644 index 00000000000..0dfab3fa2fa --- /dev/null +++ b/jstests/gle/create_index_gle.js @@ -0,0 +1,43 @@ +var st = new ShardingTest({ shards: { rs0: { nodes: 2, oplogSize: 10, verbose: 1 }}}); +var replTest = st.rs0; + +var config = replTest.getReplSetConfig(); +config.members[1].priority = 0; +// Add a delay long enough so getLastError would actually 'wait' for write concern. +config.members[1].slaveDelay = 3; +config.version = 2; + +var priConn = replTest.getPrimary(); + +try { + priConn.getDB('admin').runCommand({ replSetReconfig: config }); +} catch (x) { + print('reconfig closed conn'); +} + +assert.soon(function() { + var secConn = replTest.getSecondary(); + var config = secConn.getDB('local').system.replset.findOne(); + return config.members[1].slaveDelay == 3; +}); + +replTest.awaitSecondaryNodes(); + +var testDB = st.s.getDB('test'); +testDB.adminCommand({ connPoolSync: 1 }); + +var secConn = replTest.getSecondary(); +var testDB2 = secConn.getDB('test'); + +testDB.user.insert({ x: 1 }); + +testDB.user.ensureIndex({ x: 1 }); +assert.gleOK(testDB.runCommand({ getLastError: 1, w: 2 })); + +var priIdx = testDB.user.getIndexes(); +var secIdx = testDB2.user.getIndexes(); + +assert.eq(priIdx.length, secIdx.length, 'pri: ' + tojson(priIdx) + ', sec: ' + tojson(secIdx)); + +st.stop(); + |