blob: 0797fa368a5eb6a2b82f69515cf23de9203be52b (
plain)
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
40
41
42
43
44
45
46
|
// Test for SERVER-3763
var st = new ShardingTest({ shards : 2 })
var coll = st.s.getCollection( jsTestName() + ".coll" )
coll.drop()
// Shard collection over two shards
st.shardColl( coll, { _id : 1 }, { _id : 0 } )
var negShard = st.getShard( coll, { _id : -1 }, true )
var posShard = st.getShard( coll, { _id : 1 }, true )
jsTestLog( "Sharding status..." )
st.printShardingStatus()
jsTestLog( "Shutting down negative shard..." )
MongoRunner.stopMongod( negShard )
jsTestLog( "Inserting into negative shard..." )
coll.insert({ _id : -1 })
print( "GLE start" )
var gle_state = 0;
try{
var myjson = coll.getDB().getLastErrorObj();
if ( myjson.err != "socket exception" ) {
gle_state = 1;
print( "Unit test failure -- received response from getLastError:" );
printjson( myjson );
}
}
catch( e ){
printjson( e )
}
assert( !gle_state );
jsTestLog( "Inserting into positive shard..." )
coll.insert({ _id : 1 })
print( "GLE start" )
printjson( coll.getDB().getLastError() )
print( "test ending" )
st.stop()
|