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

mapReduce failure when autoSplit is disabled and a sharded output collection is specified

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.2.4
    • Component/s: MapReduce, Sharding
    • None
    • ALL
    • Hide
      var st = new ShardingTest({
              shards: {rs0: {nodes: 1}, rs1: {nodes: 1}},
              mongos: 1,
              other: {mongosOptions: {noAutoSplit: ""}}
          });
      
      var dbName = "wc-test";
      var mongos = st.s;
      var db = mongos.getDB(dbName);
      var collName = 'leaves';
      var coll = db[collName];
      
      db.adminCommand({enablesharding: db.toString()});
      coll.insert({a: 1, x: -3, tags: ["a", "b"]});
      coll.insert({a: 2, x: -7, tags: ["b", "c"]});
      coll.insert({a: 3, x: 23, tags: ["c", "a"]});
      coll.insert({a: 4, x: 27, tags: ["b", "c"]});
      
      db.runCommand({
                  mapReduce: collName,
                  map: function() {
                      this.tags.forEach(function(z) {
                          emit(z, 1);
                      });
                  },
                  reduce: function(key, values) {
                      return {
                          count: values.length
                      };
                  },
                  out: {replace: "foo", db: dbName, sharded: true}
              });
      
      
      Show
      var st = new ShardingTest({ shards: {rs0: {nodes: 1}, rs1: {nodes: 1}}, mongos: 1, other: {mongosOptions: {noAutoSplit: ""}} }); var dbName = "wc-test"; var mongos = st.s; var db = mongos.getDB(dbName); var collName = 'leaves'; var coll = db[collName]; db.adminCommand({enablesharding: db.toString()}); coll.insert({a: 1, x: -3, tags: ["a", "b"]}); coll.insert({a: 2, x: -7, tags: ["b", "c"]}); coll.insert({a: 3, x: 23, tags: ["c", "a"]}); coll.insert({a: 4, x: 27, tags: ["b", "c"]}); db.runCommand({ mapReduce: collName, map: function() { this.tags.forEach(function(z) { emit(z, 1); }); }, reduce: function(key, values) { return { count: values.length }; }, out: {replace: "foo", db: dbName, sharded: true} });
    • None
    • 0
    • None
    • None
    • None
    • None
    • None
    • None

      When autoSplit is disabled and a mapReduce function is run with a sharded output collection, and dassert in s/chunk.cpp splitIfShould() fails and terminates the call with the following stack trace. cluster_map_reduce_cmd.cpp should check if autoSplitting is allowed before calling splitIfShould()

      s20005| 2016-03-21T15:48:45.814-0400 I -        [conn1] Invariant failure ShouldAutoSplit src/mongo/s/chunk.cpp 520
      s20005| 2016-03-21T15:48:45.814-0400 I -        [conn1] 
      s20005| 
      s20005| ***aborting after invariant() failure
      s20005| 
      s20005| 
      s20005| 2016-03-21T15:48:45.845-0400 F -        [conn1] Got signal: 6 (Aborted).
      s20005| 
      s20005|  0x184ebfd 0x184dc28 0x184e087 0x7fe35c287d10 0x7fe35bee2267 0x7fe35bee3eca 0x17ded78 0x16bbc29 0x1721b74 0x1786e53 0x17873c8 0x17976a8 0x178611c 0x1173832 0x1809008 0x7fe35c27e6aa 0x7fe35bfb3e9d
      s20005| ----- BEGIN BACKTRACE -----
      s20005| {"backtrace":[{"b":"400000","o":"144EBFD","s":"_ZN5mongo15printStackTraceERSo"},{"b":"400000","o":"144DC28"},{"b":"400000","o":"144E087"},{"b":"7FE35C277000","o":"10D10"},{"b":"7FE35BEAD000","o":"35267","s":"gsignal"},{"b":"7FE35BEAD000","o":"36ECA","s":"abort"},{"b":"400000","o":"13DED78","s":"_ZN5mongo15invariantFailedEPKcS1_j"},{"b":"400000","o":"12BBC29","s":"_ZNK5mongo5Chunk13splitIfShouldEPNS_16OperationContextEl"},{"b":"400000","o":"1321B74"},{"b":"400000","o":"1386E53","s":"_ZN5mongo7Command22execCommandClientBasicEPNS_16OperationContextEPS0_RNS_11ClientBasicEiPKcRNS_7BSONObjERNS_14BSONObjBuilderE"},{"b":"400000","o":"13873C8","s":"_ZN5mongo7Command20runAgainstRegisteredEPNS_16OperationContextEPKcRNS_7BSONObjERNS_14BSONObjBuilderEi"},{"b":"400000","o":"13976A8","s":"_ZN5mongo8Strategy15clientCommandOpEPNS_16OperationContextERNS_7RequestE"},{"b":"400000","o":"138611C","s":"_ZN5mongo7Request7processEPNS_16OperationContextEi"},{"b":"400000","o":"D73832","s":"_ZN5mongo21ShardedMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortE"},{"b":"400000","o":"1409008","s":"_ZN5mongo17PortMessageServer17handleIncomingMsgEPv"},{"b":"7FE35C277000","o":"76AA"},{"b":"7FE35BEAD000","o":"106E9D","s":"clone"}],"processInfo":{ "mongodbVersion" : "3.3.3-150-g5c926b5", "gitVersion" : "5c926b5be3d7c8d0039907b4f4114c2315afb40e", "compiledModules" : [], "uname" : { "sysname" : "Linux", "release" : "4.2.0-30-generic", "version" : "#36-Ubuntu SMP Fri Feb 26 00:58:07 UTC 2016", "machine" : "x86_64" }, "somap" : [ { "elfType" : 2, "b" : "400000", "buildId" : "DDF8F266E45699D774C3BBB0B881F14A25F6DF81" }, { "b" : "7FFDB3FDB000", "elfType" : 3, "buildId" : "2278CCDC2E59B665EFAC994490FF7D47EAB1A8D4" }, { "b" : "7FE35CF3A000", "path" : "/lib/x86_64-linux-gnu/librt.so.1", "elfType" : 3, "buildId" : "7ED450BD936778B73D53F9E69AD2E3E0BD614277" }, { "b" : "7FE35CD36000", "path" : "/lib/x86_64-linux-gnu/libdl.so.2", "elfType" : 3, "buildId" : "A20BCC32D4C15FAB47EEC600027EF571699A03FD" }, { "b" : "7FE35C9B4000", "path" : "/usr/lib/x86_64-linux-gnu/libstdc++.so.6", "elfType" : 3, "buildId" : "9998E9D49D7C125001BB28D1E8C9424AAD13A474" }, { "b" : "7FE35C6AC000", "path" : "/lib/x86_64-linux-gnu/libm.so.6", "elfType" : 3, "buildId" : "42FC4D8B6B70D1A8469B3A1A0164A2559F4E17C3" }, { "b" : "7FE35C495000", "path" : "/lib/x86_64-linux-gnu/libgcc_s.so.1", "elfType" : 3, "buildId" : "0C3C07EE15CFA81346847A679E8444B876D9CC58" }, { "b" : "7FE35C277000", "path" : "/lib/x86_64-linux-gnu/libpthread.so.0", "elfType" : 3, "buildId" : "E68326F6C5F4C01A31EE635E6563BE58749F3AB4" }, { "b" : "7FE35BEAD000", "path" : "/lib/x86_64-linux-gnu/libc.so.6", "elfType" : 3, "buildId" : "59EAE8A903584DCBC14CF07C719CD23B9F65E230" }, { "b" : "7FE35D142000", "path" : "/lib64/ld-linux-x86-64.so.2", "elfType" : 3, "buildId" : "CC2853E4A748C809FA82EA774FBACE3AD67DAFED" } ] }}
      s20005|  mongos(_ZN5mongo15printStackTraceERSo+0x27) [0x184ebfd]
      s20005|  mongos(+0x144DC28) [0x184dc28]
      s20005|  mongos(+0x144E087) [0x184e087]
      s20005|  libpthread.so.0(+0x10D10) [0x7fe35c287d10]
      s20005|  libc.so.6(gsignal+0x37) [0x7fe35bee2267]
      s20005|  libc.so.6(abort+0x16A) [0x7fe35bee3eca]
      s20005|  mongos(_ZN5mongo15invariantFailedEPKcS1_j+0x125) [0x17ded78]
      s20005|  mongos(_ZNK5mongo5Chunk13splitIfShouldEPNS_16OperationContextEl+0x65) [0x16bbc29]
      s20005|  mongos(+0x1321B74) [0x1721b74]
      s20005|  mongos(_ZN5mongo7Command22execCommandClientBasicEPNS_16OperationContextEPS0_RNS_11ClientBasicEiPKcRNS_7BSONObjERNS_14BSONObjBuilderE+0x4F3) [0x1786e53]
      s20005|  mongos(_ZN5mongo7Command20runAgainstRegisteredEPNS_16OperationContextEPKcRNS_7BSONObjERNS_14BSONObjBuilderEi+0x2AC) [0x17873c8]
      s20005|  mongos(_ZN5mongo8Strategy15clientCommandOpEPNS_16OperationContextERNS_7RequestE+0x670) [0x17976a8]
      s20005|  mongos(_ZN5mongo7Request7processEPNS_16OperationContextEi+0x3DE) [0x178611c]
      s20005|  mongos(_ZN5mongo21ShardedMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortE+0xE6) [0x1173832]
      s20005|  mongos(_ZN5mongo17PortMessageServer17handleIncomingMsgEPv+0x443) [0x1809008]
      s20005|  libpthread.so.0(+0x76AA) [0x7fe35c27e6aa]
      s20005|  libc.so.6(clone+0x6D) [0x7fe35bfb3e9d]
      s20005| -----  END BACKTRACE  -----
      

            Assignee:
            matthew.saltz@mongodb.com Matthew Saltz (Inactive)
            Reporter:
            judah.schvimer@mongodb.com Judah Schvimer
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: