blob: 52a4b38641df816c5f29afecd2499e712175b676 (
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
|
// Tests for the connPoolStats command.
// Create a cluster with 2 shards.
var cluster = new ShardingTest({shards: 2});
// Run the connPoolStats command
stats = cluster.s.getDB("admin").runCommand({connPoolStats : 1});
// Validate output
printjson(stats);
assert.commandWorked(stats);
assert("replicaSets" in stats);
assert("pools" in stats);
var pools = stats["pools"];
// Stats from dbclient pool
assert("DBClient (Global)" in pools);
var dbclient = pools["DBClient (Global)"];
assert("hosts" in dbclient);
assert("numClientConnection" in dbclient);
assert("numAScopedConnection" in dbclient);
assert("totalInUse" in dbclient);
assert("totalAvailable" in dbclient);
assert("totalCreated" in dbclient);
assert.eq(dbclient["totalInUse"] + dbclient["totalAvailable"], dbclient["totalCreated"]);
// Stats from ASIO pool
assert("NetworkInterfaceASIO (Sharding)" in pools);
var asio = pools["NetworkInterfaceASIO (Sharding)"];
assert("hosts" in asio);
assert("totalInUse" in asio);
assert("totalAvailable" in asio);
assert("totalCreated" in asio);
assert.eq(asio["totalInUse"] + asio["totalAvailable"], asio["totalCreated"]);
|