I am writing a Java program to test various aspects of MongoDb so that we can upgrade in confidence in future. As part of this, I test aspects of sharding and shard tags.
In MongoDB 3.2 (3.2.9) the sharding steps work correctly. In MongoDB 3.4.4 (also seen in 3.4.0), after inserting the following into tags collection on config database via mongos:
db.tags.insertOne({ "_id" : { "ns" : "ddp.datasources", "min" :
{ "location" : "LN", "shard" : "LN1" }}, "ns" : "ddp.datasources", "min" :
{ "location" : "LN", "shard" : "LN1" }, "max" :
{ "location" : "LM", "shard" : "LN1" }, "tag" : "LN1" })
I get the following form the config server (I have attached mdmp):
2017-05-30T12:50:43.588+0100 I - [Balancer] Invariant failure splitPoint.woCompare(it->second.splitKeys.back()) == 0 src\mongo\db\s\balancer\balancer_chunk_selection_policy_impl.cpp 154
2017-05-30T12:50:43.589+0100 I - [Balancer]
***aborting after invariant() failure
2017-05-30T12:50:43.692+0100 I CONTROL [Balancer] mongod.exe ...\src\mongo\util\stacktrace_windows.cpp(239) mongo::printStackTrace+0x43
2017-05-30T12:50:43.693+0100 I CONTROL [Balancer] mongod.exe ...\src\mongo\util\signal_handlers_synchronous.cpp(180) mongo::`anonymous namespace'::printSignalAndBacktrace+0x74
2017-05-30T12:50:43.695+0100 I CONTROL [Balancer] mongod.exe ...\src\mongo\util\signal_handlers_synchronous.cpp(236) mongo::`anonymous namespace'::abruptQuit+0x85
2017-05-30T12:50:43.696+0100 I CONTROL [Balancer] ucrtbase.DLL raise+0x1e8
2017-05-30T12:50:43.697+0100 I CONTROL [Balancer] ucrtbase.DLL abort+0x31
2017-05-30T12:50:43.698+0100 I CONTROL [Balancer] mongod.exe ...\src\mongo\util\assert_util.cpp(154) mongo::invariantFailed+0x19a
2017-05-30T12:50:43.700+0100 I CONTROL [Balancer] mongod.exe ...\src\mongo\db\s\balancer\balancer_chunk_selection_policy_impl.cpp(154) mongo::`anonymous namespace'::SplitCandidatesBuffer::addSplitPoint+0x32e
2017-05-30T12:50:43.701+0100 I CONTROL [Balancer] mongod.exe ...\src\mongo\db\s\balancer\balancer_chunk_selection_policy_impl.cpp(408) mongo::BalancerChunkSelectionPolicyImpl::_getSplitCandidatesForCollection+0x4c6
2017-05-30T12:50:43.703+0100 I CONTROL [Balancer] mongod.exe ...\src\mongo\db\s\balancer\balancer_chunk_selection_policy_impl.cpp(217) mongo::BalancerChunkSelectionPolicyImpl::selectChunksToSplit+0x3d0
2017-05-30T12:50:43.704+0100 I CONTROL [Balancer] mongod.exe ...\src\mongo\db\s\balancer\balancer.cpp(546) mongo::Balancer::_enforceTagRanges+0x65
2017-05-30T12:50:43.705+0100 I CONTROL [Balancer] mongod.exe ...\src\mongo\db\s\balancer\balancer.cpp(387) mongo::Balancer::_mainThread+0xa41
2017-05-30T12:50:43.707+0100 I CONTROL [Balancer] mongod.exe c:\program files (x86)\microsoft visual studio 14.0\vc\include\thr\xthread(247) std::_LaunchPad<std::unique_ptr<std::tuple<<lambda_d43e9bbb1383790602f0e36fad81e7d4> >,std::default_delete<std::tuple<<lambda_d43e9bbb1383790602f0e36fad81
e7d4> > > > >::_Run+0x77
2017-05-30T12:50:43.709+0100 I CONTROL [Balancer] mongod.exe c:\program files (x86)\microsoft visual studio 14.0\vc\include\thr\xthread(210) std::_Pad::_Call_func+0x9
2017-05-30T12:50:43.710+0100 I CONTROL [Balancer] ucrtbase.DLL crt_at_quick_exit+0x7d
2017-05-30T12:50:43.712+0100 I CONTROL [Balancer] kernel32.dll BaseThreadInitThunk+0xd
2017-05-30T12:50:43.713+0100 F - [Balancer] Got signal: 22 (SIGABRT).
2017-05-30T12:50:43.715+0100 I CONTROL [Balancer] *** unhandled exception 0x0000000E at 0x000007FEFD3BA06D, terminating
2017-05-30T12:50:43.716+0100 I CONTROL [Balancer] *** stack trace for unhandled exception:
2017-05-30T12:50:43.723+0100 I CONTROL [Balancer] KERNELBASE.dll RaiseException+0x3d
2017-05-30T12:50:43.724+0100 I CONTROL [Balancer] mongod.exe ...\src\mongo\util\signal_handlers_synchronous.cpp(237) mongo::`anonymous namespace'::abruptQuit+0x9d
2017-05-30T12:50:43.726+0100 I CONTROL [Balancer] ucrtbase.DLL raise+0x1e8
2017-05-30T12:50:43.727+0100 I CONTROL [Balancer] ucrtbase.DLL abort+0x31
2017-05-30T12:50:43.728+0100 I CONTROL [Balancer] mongod.exe ...\src\mongo\util\assert_util.cpp(154) mongo::invariantFailed+0x19a
2017-05-30T12:50:43.730+0100 I CONTROL [Balancer] mongod.exe ...\src\mongo\db\s\balancer\balancer_chunk_selection_policy_impl.cpp(154) mongo::`anonymous namespace'::SplitCandidatesBuffer::addSplitPoint+0x32e
2017-05-30T12:50:43.732+0100 I CONTROL [Balancer] mongod.exe ...\src\mongo\db\s\balancer\balancer_chunk_selection_policy_impl.cpp(408) mongo::BalancerChunkSelectionPolicyImpl::_getSplitCandidatesForCollection+0x4c6
2017-05-30T12:50:43.733+0100 I CONTROL [Balancer] mongod.exe ...\src\mongo\db\s\balancer\balancer_chunk_selection_policy_impl.cpp(217) mongo::BalancerChunkSelectionPolicyImpl::selectChunksToSplit+0x3d0
2017-05-30T12:50:43.734+0100 I CONTROL [Balancer] mongod.exe ...\src\mongo\db\s\balancer\balancer.cpp(546) mongo::Balancer::_enforceTagRanges+0x65
2017-05-30T12:50:43.736+0100 I CONTROL [Balancer] mongod.exe ...\src\mongo\db\s\balancer\balancer.cpp(387) mongo::Balancer::_mainThread+0xa41
2017-05-30T12:50:43.737+0100 I CONTROL [Balancer] mongod.exe c:\program files (x86)\microsoft visual studio 14.0\vc\include\thr\xthread(247) std::_LaunchPad<std::unique_ptr<std::tuple<<lambda_d43e9bbb1383790602f0e36fad81e7d4> >,std::default_delete<std::tuple<<lambda_d43e9bbb1383790602f0e36fad
81e7d4> > > > >::_Run+0x77
2017-05-30T12:50:43.739+0100 I CONTROL [Balancer] mongod.exe c:\program files (x86)\microsoft visual studio 14.0\vc\include\thr\xthread(210) std::_Pad::_Call_func+0x9
2017-05-30T12:50:43.741+0100 I CONTROL [Balancer] ucrtbase.DLL crt_at_quick_exit+0x7d
2017-05-30T12:50:43.742+0100 I CONTROL [Balancer] kernel32.dll BaseThreadInitThunk+0xd
2017-05-30T12:50:43.744+0100 I - [Balancer]
2017-05-30T12:50:43.746+0100 I CONTROL [Balancer] writing minidump diagnostic file C:\Program Files\MongoDB\Server\3.2017-05-30T11-50-43.mdmp
2017-05-30T12:50:44.017+0100 I CONTROL [Balancer] *** immediate exit due to unhandled exception