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

mongos aborts in debug builds if additional options specified to update and delete bulk ops

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.4.0-rc3
    • Affects Version/s: None
    • Component/s: Sharding, Write Ops
    • Labels:
      None
    • Fully Compatible
    • ALL
    • Hide
      python buildscripts/resmoke.py --executor=sharding_jscore_passthrough repro_estsize.js --storageEngine=wiredTiger
      
      repro_estsize.js
      db.mycoll.bulkWrite([{
          deleteMany: {
              filter: { str: 'FOO' },
              collation: {
                  locale: "en_US",
                  caseLevel: false,
                  caseFirst: "off",
                  strength: 3,
                  numericOrdering: false,
                  alternate: "non-ignorable",
                  maxVariable: "punct",
                  normalization: false,
                  backwards: false
              }
          }
      }]);
      
      Output
      [ShardedClusterFixture:job0:mongos] 2016-09-20T13:53:07.746-0400 I -        [conn5] Invariant failure estSize >= item.getDelete()->toBSON().objsize() src/mongo/s/write_ops/batch_write_op.cpp 167
      [ShardedClusterFixture:job0:mongos] 2016-09-20T13:53:07.746-0400 I -        [conn5]
      [ShardedClusterFixture:job0:mongos]
      [ShardedClusterFixture:job0:mongos] ***aborting after invariant() failure
      
      Show
      python buildscripts/resmoke.py --executor=sharding_jscore_passthrough repro_estsize.js --storageEngine=wiredTiger repro_estsize.js db.mycoll.bulkWrite([{ deleteMany: { filter: { str: 'FOO' }, collation: { locale: "en_US" , caseLevel: false , caseFirst: "off" , strength: 3, numericOrdering: false , alternate: "non-ignorable" , maxVariable: "punct" , normalization: false , backwards: false } } }]); Output [ShardedClusterFixture:job0:mongos] 2016-09-20T13:53:07.746-0400 I - [conn5] Invariant failure estSize >= item.getDelete()->toBSON().objsize() src/mongo/s/write_ops/batch_write_op.cpp 167 [ShardedClusterFixture:job0:mongos] 2016-09-20T13:53:07.746-0400 I - [conn5] [ShardedClusterFixture:job0:mongos] [ShardedClusterFixture:job0:mongos] ***aborting after invariant() failure
    • Query 2016-10-31, Query 2016-11-21

      The getWriteSizeBytes() function bases its estimate off of the size of the query filter in BSON and doesn't account for the size of the collation specification in BSON.

      static int getWriteSizeBytes(const WriteOp& writeOp) {
          const BatchItemRef& item = writeOp.getWriteItem();
          BatchedCommandRequest::BatchType batchType = item.getOpType();
      
          if (batchType == BatchedCommandRequest::BatchType_Insert) {
              return item.getDocument().objsize();
          } else if (batchType == BatchedCommandRequest::BatchType_Update) {
              // Note: Be conservative here - it's okay if we send slightly too many batches
              int estSize = item.getUpdate()->getQuery().objsize() +
                  item.getUpdate()->getUpdateExpr().objsize() + kEstUpdateOverheadBytes;
              dassert(estSize >= item.getUpdate()->toBSON().objsize());
              return estSize;
          } else {
              dassert(batchType == BatchedCommandRequest::BatchType_Delete);
              // Note: Be conservative here - it's okay if we send slightly too many batches
              int estSize = item.getDelete()->getQuery().objsize() + kEstDeleteOverheadBytes;
              dassert(estSize >= item.getDelete()->toBSON().objsize());
              return estSize;
          }
      }
      

            Assignee:
            marko.vojvodic@mongodb.com Marko Vojvodic
            Reporter:
            max.hirschhorn@mongodb.com Max Hirschhorn
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: