Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-30333

Segfault in 3.2 when loading chunks with unknown shard

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 3.2.15
    • Fix Version/s: 3.2.17
    • Component/s: Sharding
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide
      1. Start sharded cluster (1 shard)
      2. Shard a collection
      3. Stop the mongos
      4. Connect to the configsvr, update the chunk to refer to a non-existent shard
      5. Start the mongos
      6. Do a find on the sharded collection
      Show
      Start sharded cluster (1 shard) Shard a collection Stop the mongos Connect to the configsvr, update the chunk to refer to a non-existent shard Start the mongos Do a find on the sharded collection
    • Sprint:
      Sharding 2017-07-31, Sharding 2017-08-21

      Description

      This happens when a chunk accidentally has a shard field that refers to a non-existent shard (ie. not in config.shards). This could occur during configdb brain surgery, eg. the chunk's shard field was accidentally mangled/typoed, or one of the config.shards documents was accidentally lost,

      When the ChunkManager attempts to load the chunks, MongoDB 3.2 dereferences a null pointer and so crashes with signal 11 (segfault). MongoDB 3.4 correctly errors the operation.

      While it's true that this is a very messed-up state that should never occur naturally, the server still shouldn't crash completely.

      Undesired behaviour (segfault, 3.2):

      kev@basique:~$ mlaunch init --single --sharded 1 --port 12345 --binarypath /m/3.2.15/bin --csrs
      launching: /m/3.2.15/bin/mongod on port 12346
      launching: config server on port 12347
      replica set 'configRepl' initialized.
      launching: /m/3.2.15/bin/mongos on port 12345
      adding shards.
       
      kev@basique:~$ mongo --port 12345
      MongoDB shell version v3.4.6
      connecting to: mongodb://127.0.0.1:12345/
      MongoDB server version: 3.2.15
      WARNING: shell and server versions do not match
      connection to 127.0.0.1:12345, version 3.2.15
      db: test
      (127.0.0.1:12345/test)mongos
      > db.enableSharding()
      { "ok" : 1 }
      (127.0.0.1:12345/test)mongos
      > db.test.shardCollection({_id:1})
      { "collectionsharded" : "test.test", "ok" : 1 }
      (127.0.0.1:12345/test)mongos
      >
      bye
       
      kev@basique:~$ mlaunch stop mongos
      sent signal 15 to 1 process.
       
      kev@basique:~$ mongo --port 12347
      MongoDB shell version v3.4.6
      connecting to: mongodb://127.0.0.1:12347/
      MongoDB server version: 3.2.15
      WARNING: shell and server versions do not match
      connection to 127.0.0.1:12347, version 3.2.15
      db: test
      (127.0.0.1:12347/test)configRepl:PRIMARY
      > use config
      switched to db config
      (127.0.0.1:12347/config)configRepl:PRIMARY
      > db.shards.find()
      { "_id" : "shard01", "host" : "basique:12346" }
      (127.0.0.1:12347/config)configRepl:PRIMARY
      > db.chunks.find()
      { "_id" : "test.test-_id_MinKey", "ns" : "test.test", "min" : { "_id" : { "$minKey" : 1 } }, "max" : { "_id" : { "$maxKey" : 1 } }, "shard" : "shard01", "lastmod" : Timestamp(1, 0), "lastmodEpoch" : ObjectId("5977f7539118ba052b55c40f") }
      (127.0.0.1:12347/config)configRepl:PRIMARY
      > db.chunks.update({}, {$set:{shard:"nonexist"}})
      WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
      (127.0.0.1:12347/config)configRepl:PRIMARY
      >
      bye
       
      kev@basique:~$ mlaunch start mongos
      launching: /m/3.2.15/bin/mongos on port 12345
       
      kev@basique:~$ mongo --port 12345
      MongoDB shell version v3.4.6
      connecting to: mongodb://127.0.0.1:12345/
      MongoDB server version: 3.2.15
      WARNING: shell and server versions do not match
      connection to 127.0.0.1:12345, version 3.2.15
      db: test
      (127.0.0.1:12345/test)mongos
      > db.test.find()
      Error: error doing query: failed: network error while attempting to run command 'find' on host '127.0.0.1:12345'
      2017-07-26T11:59:41.825+1000 I NETWORK  [thread1] trying reconnect to 127.0.0.1:12345 (127.0.0.1) failed
      2017-07-26T11:59:41.825+1000 W NETWORK  [thread1] Failed to connect to 127.0.0.1:12345, in(checking socket for error after poll), reason: Connection refused
      2017-07-26T11:59:41.825+1000 I NETWORK  [thread1] reconnect 127.0.0.1:12345 (127.0.0.1) failed failed
      2017-07-26T11:59:41.828+1000 I NETWORK  [thread1] trying reconnect to 127.0.0.1:12345 (127.0.0.1) failed
      2017-07-26T11:59:41.828+1000 W NETWORK  [thread1] Failed to connect to 127.0.0.1:12345, in(checking socket for error after poll), reason: Connection refused
      2017-07-26T11:59:41.828+1000 I NETWORK  [thread1] reconnect 127.0.0.1:12345 (127.0.0.1) failed failed
      >
      bye
       
      kev@basique:~$ less data/mongos.log
      ...
      2017-07-26T11:59:41.622+1000 I SHARDING [conn6] ChunkManager loading chunks for test.test sequenceNumber: 2 based on: (empty)
      2017-07-26T11:59:41.622+1000 F -        [conn6] Invalid access at address: 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] Got signal: 11 (Segmentation fault).
       
       0xda0cb2 0xd9fc59 0xda0637 0x7fda51ae3390 0xbf11d0 0xbedb97 0xbf46b3 0xbf7bf0 0xca3f82 0xca4b84 0xca4e88 0xb37001 0xcbf17b 0xc48614 0xcc6e3c 0xcc7648 0xcdc493 0xcc5fc9 0x6cbf45 0xd4c171 0x7fda51ad96ba 0x7fda5180f3dd
      ----- BEGIN BACKTRACE -----
      {"backtrace":[{"b":"400000","o":"9A0CB2","s":"_ZN5mongo15printStackTraceERSo"},{"b":"400000","o":"99FC59"},{"b":"400000","o":"9A0637"},{"b":"7FDA51AD2000","o":"11390"},{"b":"400000","o":"7F11D0"},{"b":"400000","o":"7EDB97","s":"_ZN5mongo17ConfigDiffTrackerISt10shared_ptrINS_5ChunkEEE19calculateConfigDiffEPNS_16OperationContextERKSt6vectorINS_9ChunkTypeESaIS8_EE"},{"b":"400000","o":"7F46B3","s":"_ZN5mongo12ChunkManager5_loadEPNS_16OperationContextERSt3mapINS_7BSONObjESt10shared_ptrINS_5ChunkEENS_10BSONObjCmpESaISt4pairIKS4_S7_EEERSt3setINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4lessISL_ESaISL_EEPS3_ISL_NS_12ChunkVersionESN_SaIS9_IKSL_SR_EEEPKS0_"},{"b":"400000","o":"7F7BF0","s":"_ZN5mongo12ChunkManager18loadExistingRangesEPNS_16OperationContextEPKS0_"},{"b":"400000","o":"8A3F82","s":"_ZN5mongo14CollectionInfoC2EPNS_16OperationContextERKNS_14CollectionTypeENS_4repl6OpTimeE"},{"b":"400000","o":"8A4B84","s":"_ZN5mongo8DBConfig13_loadIfNeededEPNS_16OperationContextEy"},{"b":"400000","o":"8A4E88","s":"_ZN5mongo8DBConfig4loadEPNS_16OperationContextE"},{"b":"400000","o":"737001","s":"_ZN5mongo12CatalogCache11getDatabaseEPNS_16OperationContextERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE"},{"b":"400000","o":"8BF17B","s":"_ZN5mongo11ClusterFind8runQueryEPNS_16OperationContextERKNS_14CanonicalQueryERKNS_21ReadPreferenceSettingEPSt6vectorINS_7BSONObjESaISA_EE"},{"b":"400000","o":"848614"},{"b":"400000","o":"8C6E3C","s":"_ZN5mongo7Command22execCommandClientBasicEPNS_16OperationContextEPS0_RNS_11ClientBasicEiPKcRNS_7BSONObjERNS_14BSONObjBuilderE"},{"b":"400000","o":"8C7648","s":"_ZN5mongo7Command20runAgainstRegisteredEPNS_16OperationContextEPKcRNS_7BSONObjERNS_14BSONObjBuilderEi"},{"b":"400000","o":"8DC493","s":"_ZN5mongo8Strategy15clientCommandOpEPNS_16OperationContextERNS_7RequestE"},{"b":"400000","o":"8C5FC9","s":"_ZN5mongo7Request7processEPNS_16OperationContextEi"},{"b":"400000","o":"2CBF45","s":"_ZN5mongo21ShardedMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortE"},{"b":"400000","o":"94C171","s":"_ZN5mongo17PortMessageServer17handleIncomingMsgEPv"},{"b":"7FDA51AD2000","o":"76BA"},{"b":"7FDA51708000","o":"1073DD","s":"clone"}],"processInfo":{ "mongodbVersion" : "3.2.15", "gitVersion" : "e11e3c1b9c9ce3f7b4a79493e16f5e4504e01140", "compiledModules" : [], "uname" : { "sysname" : "Linux", "release" : "4.8.2-040802-generic", "version" : "#201610161339 SMP Sun Oct 16 17:41:46 UTC 2016", "machine" : "x86_64" }, "somap" : [ { "elfType" : 2, "b" : "400000", "buildId" : "4ABF87DF8597F7A1E919A707CEC69A5B9B4DB0E2" }, { "b" : "7FFE787CB000", "elfType" : 3, "buildId" : "88952B90E05D452D09F66E5A40C34F28258CAF89" }, { "b" : "7FDA52A5E000", "path" : "/lib/x86_64-linux-gnu/libssl.so.1.0.0", "elfType" : 3, "buildId" : "7F514146540382F59AD705BA8C913A75204C6858" }, { "b" : "7FDA5261A000", "path" : "/lib/x86_64-linux-gnu/libcrypto.so.1.0.0", "elfType" : 3, "buildId" : "E6D4D2E4A048992CD5501E5985094E6CEC6C5D4F" }, { "b" : "7FDA52412000", "path" : "/lib/x86_64-linux-gnu/librt.so.1", "elfType" : 3, "buildId" : "F951C1E0765FCAE48F82CAFE35D1ADD36D6C9AF9" }, { "b" : "7FDA5220E000", "path" : "/lib/x86_64-linux-gnu/libdl.so.2", "elfType" : 3, "buildId" : "0FC788F0861846257B5F1773FBD438E95DFC1032" }, { "b" : "7FDA51F05000", "path" : "/lib/x86_64-linux-gnu/libm.so.6", "elfType" : 3, "buildId" : "FF7A33D389E756CA381A8189291A968EA5E1F4F8" }, { "b" : "7FDA51CEF000", "path" : "/lib/x86_64-linux-gnu/libgcc_s.so.1", "elfType" : 3, "buildId" : "68220AE2C65D65C1B6AAA12FA6765A6EC2F5F434" }, { "b" : "7FDA51AD2000", "path" : "/lib/x86_64-linux-gnu/libpthread.so.0", "elfType" : 3, "buildId" : "27F189EF8DB8C3734C6A678E6EF3CB0B206D58B2" }, { "b" : "7FDA51708000", "path" : "/lib/x86_64-linux-gnu/libc.so.6", "elfType" : 3, "buildId" : "088A6E00A1814622219F346B41E775B8DD46C518" }, { "b" : "7FDA52CC7000", "path" : "/lib64/ld-linux-x86-64.so.2", "elfType" : 3, "buildId" : "9157F205547F0EB588E2AB1F2F120B74253A43EA" } ] }}
       mongos(_ZN5mongo15printStackTraceERSo+0x32) [0xda0cb2]
       mongos(+0x99FC59) [0xd9fc59]
       mongos(+0x9A0637) [0xda0637]
       libpthread.so.0(+0x11390) [0x7fda51ae3390]
       mongos(+0x7F11D0) [0xbf11d0]
       mongos(_ZN5mongo17ConfigDiffTrackerISt10shared_ptrINS_5ChunkEEE19calculateConfigDiffEPNS_16OperationContextERKSt6vectorINS_9ChunkTypeESaIS8_EE+0x847) [0xbedb97]
       mongos(_ZN5mongo12ChunkManager5_loadEPNS_16OperationContextERSt3mapINS_7BSONObjESt10shared_ptrINS_5ChunkEENS_10BSONObjCmpESaISt4pairIKS4_S7_EEERSt3setINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4lessISL_ESaISL_EEPS3_ISL_NS_12ChunkVersionESN_SaIS9_IKSL_SR_EEEPKS0_+0xAB3) [0xbf46b3]
       mongos(_ZN5mongo12ChunkManager18loadExistingRangesEPNS_16OperationContextEPKS0_+0x2B0) [0xbf7bf0]
       mongos(_ZN5mongo14CollectionInfoC2EPNS_16OperationContextERKNS_14CollectionTypeENS_4repl6OpTimeE+0x82) [0xca3f82]
       mongos(_ZN5mongo8DBConfig13_loadIfNeededEPNS_16OperationContextEy+0x6B4) [0xca4b84]
       mongos(_ZN5mongo8DBConfig4loadEPNS_16OperationContextE+0x48) [0xca4e88]
       mongos(_ZN5mongo12CatalogCache11getDatabaseEPNS_16OperationContextERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x361) [0xb37001]
       mongos(_ZN5mongo11ClusterFind8runQueryEPNS_16OperationContextERKNS_14CanonicalQueryERKNS_21ReadPreferenceSettingEPSt6vectorINS_7BSONObjESaISA_EE+0x33B) [0xcbf17b]
       mongos(+0x848614) [0xc48614]
       mongos(_ZN5mongo7Command22execCommandClientBasicEPNS_16OperationContextEPS0_RNS_11ClientBasicEiPKcRNS_7BSONObjERNS_14BSONObjBuilderE+0x7EC) [0xcc6e3c]
       mongos(_ZN5mongo7Command20runAgainstRegisteredEPNS_16OperationContextEPKcRNS_7BSONObjERNS_14BSONObjBuilderEi+0x328) [0xcc7648]
       mongos(_ZN5mongo8Strategy15clientCommandOpEPNS_16OperationContextERNS_7RequestE+0x483) [0xcdc493]
       mongos(_ZN5mongo7Request7processEPNS_16OperationContextEi+0x6B9) [0xcc5fc9]
       mongos(_ZN5mongo21ShardedMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortE+0x65) [0x6cbf45]
       mongos(_ZN5mongo17PortMessageServer17handleIncomingMsgEPv+0x311) [0xd4c171]
       libpthread.so.0(+0x76BA) [0x7fda51ad96ba]
       libc.so.6(clone+0x6D) [0x7fda5180f3dd]
      -----  END BACKTRACE  -----
      2017-07-26T11:59:41.627+1000 F -        [conn6] /proc/self/maps:
      00400000-0126e000 r-xp 00000000 fd:01 3547010                            /usr/local/sw/mongodb/3.2.15/bin/mongos
      2017-07-26T11:59:41.627+1000 F -        [conn6] 0126e000-012af000 rw-p 00e6e000 fd:01 3547010                            /usr/local/sw/mongodb/3.2.15/bin/mongos
      2017-07-26T11:59:41.627+1000 F -        [conn6] 012af000-01308000 rw-p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 01beb000-026ec000 rw-p 00000000 00:00 0                                  [heap]
      2017-07-26T11:59:41.627+1000 F -        [conn6] 026ec000-027ec000 rw-p 00000000 00:00 0                                  [heap]
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4980c000-7fda4980d000 ---p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4980d000-7fda4990d000 rw-p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4990d000-7fda4990e000 ---p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4990e000-7fda49a0e000 rw-p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda49a0e000-7fda49a0f000 ---p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda49a0f000-7fda4a20f000 rw-p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4a20f000-7fda4a210000 ---p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4a210000-7fda4aa10000 rw-p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4aa10000-7fda4aa11000 ---p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4aa11000-7fda4b211000 rw-p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4b211000-7fda4b212000 ---p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4b212000-7fda4ba12000 rw-p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4ba12000-7fda4ba13000 ---p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4ba13000-7fda4c213000 rw-p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4c213000-7fda4c214000 ---p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4c214000-7fda4ca14000 rw-p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4ca14000-7fda4ca1f000 r-xp 00000000 fd:01 1190193                    /lib/x86_64-linux-gnu/libnss_files-2.23.so
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4ca1f000-7fda4cc1e000 ---p 0000b000 fd:01 1190193                    /lib/x86_64-linux-gnu/libnss_files-2.23.so
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4cc1e000-7fda4cc1f000 r--p 0000a000 fd:01 1190193                    /lib/x86_64-linux-gnu/libnss_files-2.23.so
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4cc1f000-7fda4cc20000 rw-p 0000b000 fd:01 1190193                    /lib/x86_64-linux-gnu/libnss_files-2.23.so
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4cc20000-7fda4cc26000 rw-p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4cc26000-7fda4cc27000 ---p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4cc27000-7fda4d427000 rw-p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4d427000-7fda4d428000 ---p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4d428000-7fda4dc28000 rw-p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4dc28000-7fda4dc29000 ---p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4dc29000-7fda4e429000 rw-p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4e429000-7fda4e42a000 ---p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4e42a000-7fda4ec2a000 rw-p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4ec2a000-7fda4ec2b000 ---p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4ec2b000-7fda4f42b000 rw-p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4f42b000-7fda4f42c000 ---p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4f42c000-7fda4fc2c000 rw-p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4fc2c000-7fda4fc2d000 ---p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda4fc2d000-7fda5042d000 rw-p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda5042d000-7fda5042e000 ---p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda5042e000-7fda50c2e000 rw-p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda50c2e000-7fda50c2f000 ---p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda50c2f000-7fda5142f000 rw-p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda5142f000-7fda51708000 r--p 00000000 fd:01 3542647                    /usr/lib/locale/locale-archive
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda51708000-7fda518c8000 r-xp 00000000 fd:01 1190212                    /lib/x86_64-linux-gnu/libc-2.23.so
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda518c8000-7fda51ac8000 ---p 001c0000 fd:01 1190212                    /lib/x86_64-linux-gnu/libc-2.23.so
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda51ac8000-7fda51acc000 r--p 001c0000 fd:01 1190212                    /lib/x86_64-linux-gnu/libc-2.23.so
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda51acc000-7fda51ace000 rw-p 001c4000 fd:01 1190212                    /lib/x86_64-linux-gnu/libc-2.23.so
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda51ace000-7fda51ad2000 rw-p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda51ad2000-7fda51aea000 r-xp 00000000 fd:01 1190195                    /lib/x86_64-linux-gnu/libpthread-2.23.so
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda51aea000-7fda51ce9000 ---p 00018000 fd:01 1190195                    /lib/x86_64-linux-gnu/libpthread-2.23.so
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda51ce9000-7fda51cea000 r--p 00017000 fd:01 1190195                    /lib/x86_64-linux-gnu/libpthread-2.23.so
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda51cea000-7fda51ceb000 rw-p 00018000 fd:01 1190195                    /lib/x86_64-linux-gnu/libpthread-2.23.so
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda51ceb000-7fda51cef000 rw-p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda51cef000-7fda51d05000 r-xp 00000000 fd:01 1184437                    /lib/x86_64-linux-gnu/libgcc_s.so.1
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda51d05000-7fda51f04000 ---p 00016000 fd:01 1184437                    /lib/x86_64-linux-gnu/libgcc_s.so.1
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda51f04000-7fda51f05000 rw-p 00015000 fd:01 1184437                    /lib/x86_64-linux-gnu/libgcc_s.so.1
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda51f05000-7fda5200d000 r-xp 00000000 fd:01 1190207                    /lib/x86_64-linux-gnu/libm-2.23.so
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda5200d000-7fda5220c000 ---p 00108000 fd:01 1190207                    /lib/x86_64-linux-gnu/libm-2.23.so
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda5220c000-7fda5220d000 r--p 00107000 fd:01 1190207                    /lib/x86_64-linux-gnu/libm-2.23.so
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda5220d000-7fda5220e000 rw-p 00108000 fd:01 1190207                    /lib/x86_64-linux-gnu/libm-2.23.so
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda5220e000-7fda52211000 r-xp 00000000 fd:01 1190201                    /lib/x86_64-linux-gnu/libdl-2.23.so
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda52211000-7fda52410000 ---p 00003000 fd:01 1190201                    /lib/x86_64-linux-gnu/libdl-2.23.so
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda52410000-7fda52411000 r--p 00002000 fd:01 1190201                    /lib/x86_64-linux-gnu/libdl-2.23.so
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda52411000-7fda52412000 rw-p 00003000 fd:01 1190201                    /lib/x86_64-linux-gnu/libdl-2.23.so
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda52412000-7fda52419000 r-xp 00000000 fd:01 1190198                    /lib/x86_64-linux-gnu/librt-2.23.so
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda52419000-7fda52618000 ---p 00007000 fd:01 1190198                    /lib/x86_64-linux-gnu/librt-2.23.so
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda52618000-7fda52619000 r--p 00006000 fd:01 1190198                    /lib/x86_64-linux-gnu/librt-2.23.so
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda52619000-7fda5261a000 rw-p 00007000 fd:01 1190198                    /lib/x86_64-linux-gnu/librt-2.23.so
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda5261a000-7fda52834000 r-xp 00000000 fd:01 1179883                    /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda52834000-7fda52a33000 ---p 0021a000 fd:01 1179883                    /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda52a33000-7fda52a4f000 r--p 00219000 fd:01 1179883                    /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda52a4f000-7fda52a5b000 rw-p 00235000 fd:01 1179883                    /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda52a5b000-7fda52a5e000 rw-p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda52a5e000-7fda52abc000 r-xp 00000000 fd:01 1179884                    /lib/x86_64-linux-gnu/libssl.so.1.0.0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda52abc000-7fda52cbc000 ---p 0005e000 fd:01 1179884                    /lib/x86_64-linux-gnu/libssl.so.1.0.0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda52cbc000-7fda52cc0000 r--p 0005e000 fd:01 1179884                    /lib/x86_64-linux-gnu/libssl.so.1.0.0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda52cc0000-7fda52cc7000 rw-p 00062000 fd:01 1179884                    /lib/x86_64-linux-gnu/libssl.so.1.0.0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda52cc7000-7fda52ced000 r-xp 00000000 fd:01 1190190                    /lib/x86_64-linux-gnu/ld-2.23.so
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda52dbe000-7fda52dbf000 ---p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda52dbf000-7fda52ebf000 rw-p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda52ebf000-7fda52ec5000 rw-p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda52ee3000-7fda52eea000 r--s 00000000 fd:01 3814927                    /usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda52eea000-7fda52eec000 rw-p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda52eec000-7fda52eed000 r--p 00025000 fd:01 1190190                    /lib/x86_64-linux-gnu/ld-2.23.so
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda52eed000-7fda52eee000 rw-p 00026000 fd:01 1190190                    /lib/x86_64-linux-gnu/ld-2.23.so
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7fda52eee000-7fda52eef000 rw-p 00000000 00:00 0
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7ffe786c1000-7ffe786e2000 rw-p 00000000 00:00 0                          [stack]
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7ffe787c9000-7ffe787cb000 r--p 00000000 00:00 0                          [vvar]
      2017-07-26T11:59:41.627+1000 F -        [conn6] 7ffe787cb000-7ffe787cd000 r-xp 00000000 00:00 0                          [vdso]
      2017-07-26T11:59:41.627+1000 F -        [conn6] ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
      

      Desired behaviour (error, 3.4):

      kev@basique:~$ mlaunch init --single --sharded 1 --port 12345
      launching: mongod on port 12346
      launching: config server on port 12347
      replica set 'configRepl' initialized.
      launching: mongos on port 12345
      adding shards.
       
      kev@basique:~$ mongo --port 12345
      MongoDB shell version v3.4.6
      connecting to: mongodb://127.0.0.1:12345/
      MongoDB server version: 3.4.6
      connection to 127.0.0.1:12345, version 3.4.6
      db: test
      (127.0.0.1:12345/test)mongos
      > db.enableSharding()
      { "ok" : 1 }
      (127.0.0.1:12345/test)mongos
      > db.test.shardCollection({_id:1})
      { "collectionsharded" : "test.test", "ok" : 1 }
      (127.0.0.1:12345/test)mongos
      >
      bye
       
      kev@basique:~$ mlaunch stop mongos
      1 node stopped.
       
      kev@basique:~$ mongo --port 12347
      MongoDB shell version v3.4.6
      connecting to: mongodb://127.0.0.1:12347/
      MongoDB server version: 3.4.6
      connection to 127.0.0.1:12347, version 3.4.6
      db: test
      (127.0.0.1:12347/test)configRepl:PRIMARY
      > use config
      switched to db config
      (127.0.0.1:12347/config)configRepl:PRIMARY
      > db.shards.find()
      { "_id" : "shard01", "host" : "basique:12346", "state" : 1 }
      (127.0.0.1:12347/config)configRepl:PRIMARY
      > db.chunks.find()
      { "_id" : "test.test-_id_MinKey", "ns" : "test.test", "min" : { "_id" : { "$minKey" : 1 } }, "max" : { "_id" : { "$maxKey" : 1 } }, "shard" : "shard01", "lastmod" : Timestamp(1, 0), "lastmodEpoch" : ObjectId("5977f417e83ec898387411d8") }
      (127.0.0.1:12347/config)configRepl:PRIMARY
      > db.chunks.update({}, {$set:{shard:"nonexist"}})
      WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
      (127.0.0.1:12347/config)configRepl:PRIMARY
      >
      bye
       
      kev@basique:~$ mlaunch start mongos
      launching: mongos on port 12345
       
      kev@basique:~$ mongo --port 12345
      MongoDB shell version v3.4.6
      connecting to: mongodb://127.0.0.1:12345/
      MongoDB server version: 3.4.6
      connection to 127.0.0.1:12345, version 3.4.6
      db: test
      (127.0.0.1:12345/test)mongos
      > db.test.find()
      Error: error: {
              "ok" : 0,
              "errmsg" : "Shard nonexist not found",
              "code" : 70,
              "codeName" : "ShardNotFound"
      }
      (127.0.0.1:12345/test)mongos
      >
      

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: