[SERVER-18804] Invariant failure when running explained update against config or admin db in sharded cluster Created: 03/Jun/15  Updated: 19/Jun/15  Resolved: 08/Jun/15

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 3.1.3
Fix Version/s: 3.1.4

Type: Bug Priority: Major - P3
Reporter: Kamran K. Assignee: Kaloian Manassiev
Resolution: Done Votes: 0
Labels: 32qa, FT
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

var st = new ShardingTest({});
var myDB = st.s0.getDB('admin'); // 'config' also causes an invariant failure
 
myDB.runCommand({explain: {update: 'z', updates: [{q: {}, u: {a: 1}}]}});

Participants:

 Description   

In 3.0.3, explained updates against the 'config' and 'admin' databases return explain plans.

In newer 3.1.x versions, the explained updates cause invariant failures because there's no shard information for the 'config' and 'admin' databases.

Invariant failure shard src/mongo/s/client/shard.cpp 120
 
#0  0x00007fb841f6920b in raise (sig=5) at ../nptl/sysdeps/unix/sysv/linux/pt-raise.c:37
#1  0x0000000000fd06b4 in mongo::breakpoint () at src/mongo/util/debugger.cpp:57
#2  0x0000000000fc2e49 in mongo::invariantFailed (expr=0x11ef5ad "shard", file=0x11ef582 "src/mongo/s/client/shard.cpp", line=120) at src/mongo/util/assert_util.cpp:153
#3  0x0000000000f08251 in mongo::Shard::reset (this=0x7fb8404b90b0, ident=...) at src/mongo/s/client/shard.cpp:120
#4  0x0000000000e71908 in mongo::Shard::make (ident=...) at src/mongo/s/client/shard.h:82
#5  0x0000000000f7cda9 in mongo::Strategy::commandOpWrite (this=0x1e18210, dbName=..., command=..., targetingBatchItem=..., results=0x7fb8404b9370) at src/mongo/s/strategy.cpp:481
#6  0x0000000000f47a5f in mongo::(anonymous namespace)::ClusterWriteCmd::explain (this=0x1740720 <mongo::(anonymous namespace)::clusterUpdateCmd>, txn=0x0, dbname=..., cmdObj=..., verbosity=mongo::ExplainCommon::EXEC_ALL_PLANS, 
    out=0x7fb8404b9930) at src/mongo/s/commands/cluster_write_cmd.cpp:129
#7  0x0000000000f20115 in mongo::ClusterExplainCmd::run (this=0x173ef20 <mongo::cmdExplainCluster>, txn=0x0, dbName=..., cmdObj=..., options=0, errmsg=..., result=...) at src/mongo/s/commands/cluster_explain_cmd.cpp:120
#8  0x0000000000f731fe in mongo::Command::execCommandClientBasic (txn=0x0, c=0x173ef20 <mongo::cmdExplainCluster>, client=..., queryOptions=0, ns=0x7fb8140717f4 "admin.$cmd", cmdObj=..., result=...) at src/mongo/s/s_only.cpp:128
#9  0x0000000000f73678 in mongo::Command::runAgainstRegistered (ns=0x7fb8140717f4 "admin.$cmd", jsobj=..., anObjBuilder=..., queryOptions=0) at src/mongo/s/s_only.cpp:172
#10 0x0000000000f7b908 in mongo::Strategy::clientCommandOp (this=0x1e18210, r=...) at src/mongo/s/strategy.cpp:308
#11 0x0000000000f72304 in mongo::Request::process (this=0x7fb8404b9bd0, attempt=0) at src/mongo/s/request.cpp:121
#12 0x0000000000b3eab0 in mongo::ShardedMessageHandler::process (this=0x7fffbabafaa0, m=..., p=0x1e6dcc0) at src/mongo/s/server.cpp:141
#13 0x0000000000fe3acd in mongo::PortMessageServer::handleIncomingMsg (arg=0x1e6dcc0) at src/mongo/util/net/message_server_port.cpp:227
#14 0x00007fb841f61182 in start_thread (arg=0x7fb8404ba700) at pthread_create.c:312
#15 0x00007fb841c8e47d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111



 Comments   
Comment by Kaloian Manassiev [ 08/Jun/15 ]

Fixed by commit 975319ad4e7af76ca288d2bcb65c94a4006c2d4d. With this commit, the config shard will always be present.

Generated at Thu Feb 08 03:48:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.