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

Size value is ignored when creating non-capped collections

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.6.0-rc1
    • Component/s: Storage
    • Labels:
    • ALL
    • Hide
      var myDB = db.getSiblingDB('repro');
      myDB.dropDatabase();
      myDB.createCollection('sizetest', {size: 10000000});
      myDB.sizetest.stats();
      
      Show
      var myDB = db.getSiblingDB('repro'); myDB.dropDatabase(); myDB.createCollection('sizetest', {size: 10000000}); myDB.sizetest.stats();

      In 2.4.9, if you specified a 'size' value for a non-capped collection, the storage space was pre-allocated. In master, the size value is no longer honored for non-capped collections. This is a regression caused by the changes from SERVER-8412.

      2.4.9:

      > var myDB = db.getSiblingDB('repro');
      > myDB.dropDatabase();
      { "dropped" : "repro", "ok" : 1 }
      > myDB.createCollection('sizetest', {size: 10000000});
      { "ok" : 1 }
      > myDB.sizetest.stats();
      {
      	"ns" : "repro.sizetest",
      	"count" : 0,
      	"size" : 0,
      	"storageSize" : 10002432,
      	"numExtents" : 1,
      	"nindexes" : 1,
      	"lastExtentSize" : 10002432,
      	"paddingFactor" : 1,
      	"systemFlags" : 1,
      	"userFlags" : 0,
      	"totalIndexSize" : 8176,
      	"indexSizes" : {
      		"_id_" : 8176
      	},
      	"ok" : 1
      }
      

      master:

      > var myDB = db.getSiblingDB('repro');
      > myDB.dropDatabase();
      { "dropped" : "repro", "ok" : 1 }
      > myDB.createCollection('sizetest', {size: 10000000});
      { "ok" : 1 }
      > myDB.sizetest.stats()
      {
      	"ns" : "repro.sizetest",
      	"count" : 0,
      	"size" : 0,
      	"storageSize" : 8192,
      	"numExtents" : 1,
      	"nindexes" : 1,
      	"lastExtentSize" : 8192,
      	"paddingFactor" : 1,
      	"systemFlags" : 1,
      	"userFlags" : 1,
      	"totalIndexSize" : 8176,
      	"indexSizes" : {
      		"_id_" : 8176
      	},
      	"ok" : 1
      }
      

      Version: 575c9cbe27ba6b9ba56b810e42508d120ae44a94

            Assignee:
            eliot Eliot Horowitz (Inactive)
            Reporter:
            kamran.khan Kamran K.
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: