Write command error field errmsg concatenation broken

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.5.4
    • Component/s: Sharding
    • ALL
    • Hide
      //
      // Start a shard
      var s = new ShardingTest("count1", 2, 1);
      var db = s.getDB("test");
      var collectionName = "batch_write_protocol";
      var coll = db.getCollection(collectionName);
      
      jsTest.log("Starting sharded write command tests...");
      
      var request;
      var result;
      
      // Create unique index
      coll.remove();
      coll.dropIndexes();
      coll.ensureIndex({a : 1}, {unique : true});
      
      //
      // Multiple docurments insert with errors, w:1 write concern specified, ordered:false
      request = {insert : collectionName
      	, documents: [{a:1}, {a:1}, {a:2}, {a:1}, {a:1}]
      	, writeConcern:{w:1}
      	, ordered:false};
      result = coll.runCommand(request)
      jsTest.log(JSON.stringify(result, null, 2))
      
      Show
      // // Start a shard var s = new ShardingTest( "count1" , 2, 1); var db = s.getDB( "test" ); var collectionName = "batch_write_protocol" ; var coll = db.getCollection(collectionName); jsTest.log( "Starting sharded write command tests..." ); var request; var result; // Create unique index coll.remove(); coll.dropIndexes(); coll.ensureIndex({a : 1}, {unique : true }); // // Multiple docurments insert with errors, w:1 write concern specified, ordered: false request = {insert : collectionName , documents: [{a:1}, {a:1}, {a:2}, {a:1}, {a:1}] , writeConcern:{w:1} , ordered: false }; result = coll.runCommand(request) jsTest.log(JSON.stringify(result, null , 2))
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      All the errmsg's in the errDetails arrays are concatenated together into the top level errmsg. This will cause a quicker return message overflow size in the case where a write command overflows the 16MB return message.

      {
        "ok": 0,
        "errCode": 65,
        "errmsg": "multiple errors in batch : E11000 duplicate key error index: test.batch_write_protocol.$a_1  dup key: { : 1.0 } :: and :: E11000 duplicate key error index: test.batch_write_protocol.$a_1  dup key: { : 1.0 } :: and :: E11000 duplicate key error index: test.batch_write_protocol.$a_1  dup key: { : 1.0 }",
        "n": 2,
        "errDetails": [
          {
            "index": 1,
            "errCode": 11000,
            "errmsg": "E11000 duplicate key error index: test.batch_write_protocol.$a_1  dup key: { : 1.0 }"
          },
          {
            "index": 3,
            "errCode": 11000,
            "errmsg": "E11000 duplicate key error index: test.batch_write_protocol.$a_1  dup key: { : 1.0 }"
          },
          {
            "index": 4,
            "errCode": 11000,
            "errmsg": "E11000 duplicate key error index: test.batch_write_protocol.$a_1  dup key: { : 1.0 }"
          }
        ]
      }
      

            Assignee:
            Greg Studer (Inactive)
            Reporter:
            Christian Amor Kvalheim
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: