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

Map Reduce Output to Collection Occasionally Kills the Server

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.8.0-rc3
    • Affects Version/s: 2.4.8, 2.6.4, 2.7.8, 2.8.0-rc2
    • Component/s: Sharding
    • None
    • Fully Compatible
    • ALL
    • Hide

      We are running on Windows 2012 R2.
      2 mongos, 1 config server, and 1 mongod (shard).

      Show
      We are running on Windows 2012 R2. 2 mongos, 1 config server, and 1 mongod (shard).

      In the .NET Driver's build matrix, we get sporadic failures when running a test related to map/reduce outputting to a collection. Sometimes our test runs go completely fine, and other times we'll get 2 or 3 failures of this across 2.4, 2.6, and 2.7 nightlies. This also only happens on sharded systems. It seems completely random. I have managed to grab log files from the mongo from 2.4 runs and 2.7 nightly runs, but haven't been able to reproduce with 2.6 yet (although the failure has occured).

      The following test is what is being run:

              [Test]
              [RequiresServer]
              public async Task ExecuteAsync_should_return_expected_result()
              {
                  await DropCollectionAsync();
                  await InsertAsync(
                      new BsonDocument { { "_id", 1 }, { "x", 1 }, { "v", 1 } },
                      new BsonDocument { { "_id", 2 }, { "x", 1 }, { "v", 2 } },
                      new BsonDocument { { "_id", 3 }, { "x", 2 }, { "v", 4 } });
      
                  var query = new BsonDocument();
                  var mapFunction = "function() { emit(this.x, this.v); }";
                  var reduceFunction = "function(key, values) { var sum = 0; for (var i = 0; i < values.length; i++) { sum += values[i]; }; return sum; }";
                  var subject = new MapReduceOutputToCollectionOperation(_collectionNamespace, _outputCollectionNamespace, mapFunction, reduceFunction, query, _messageEncoderSettings);
                  var expectedDocuments = new BsonDocument[]
                  {
                      new BsonDocument { {"_id", 1 }, { "value", 3 } },
                      new BsonDocument { {"_id", 2 }, { "value", 4 } },
                  };
      
                  var response = await ExecuteOperationAsync(subject);
      
                  response["ok"].ToBoolean().Should().BeTrue();
      
                  var documents = await ReadAllFromCollectionAsync(_outputCollectionNamespace);
                  documents.Should().BeEquivalentTo(expectedDocuments);
              }
      

        1. 24-db27020.log
          9 kB
        2. 27-db27020.log
          14 kB

            Assignee:
            randolph@mongodb.com Randolph Tan
            Reporter:
            craig.wilson@mongodb.com Craig Wilson
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: