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

Write command error field errmsg concatenation broken

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major - P3 Major - P3
    • None
    • 2.5.4
    • 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))

    Description

      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 }"
          }
        ]
      }

      Attachments

        Activity

          People

            greg_10gen Greg Studer
            christkv Christian Amor Kvalheim
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: