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

avgObjSize keep enlarging when setup usePowerOf2Sizes

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Storage
    • Environment:
      Redhat 5.2 64bit, mongoDB 2.4.6, ruby 1.9.3
    • Linux

      avgObjSize keep enlarging when setup usePowerOf2Sizes again

      I am trying to use "usePowerOf2Sizes" on my collection for reusing space since i need to drop the whole collection later. But i find out when i setup "usePowerOf2Sizes" after my insert operation, the avgObjSize is being larger and larger. The avgObjSize should only change once then return

      {ok:1}

      right? example as below
      ===================================================

      > db.gs_e89dfd94_7be7_44aa_b55b_6297cdfd9cbf.stats();
      {
              "ns" : "test007.gs_e89dfd94_7be7_44aa_b55b_6297cdfd9cbf",
              "count" : 19999,
              "size" : 5119760,
              "avgObjSize" : 256.000800040002,
              "storageSize" : 5586944,
              "numExtents" : 5,
              "nindexes" : 1,
              "lastExtentSize" : 4194304,
              "paddingFactor" : 1,
              "systemFlags" : 1,
              "userFlags" : 1,
              "totalIndexSize" : 654080,
              "indexSizes" : {
                      "_id_" : 654080
              },
              "ok" : 1
      }
      
      > db.runCommand({collMod:"gs_e89dfd94_7be7_44aa_b55b_6297cdfd9cbf","usePowerOf2Sizes":true})
      { "usePowerOf2Sizes_old" : false, "usePowerOf2Sizes_new" : true, "ok" : 1 }
      
      > insert
      
      > db.runCommand({collMod:"gs_e89dfd94_7be7_44aa_b55b_6297cdfd9cbf","usePowerOf2Sizes":true})
      { "ok" : 1 }
      > db.gs_e89dfd94_7be7_44aa_b55b_6297cdfd9cbf.stats();
      {
              "ns" : "test007.gs_e89dfd94_7be7_44aa_b55b_6297cdfd9cbf",
              "count" : 20000,
              "size" : 5120256,
              "avgObjSize" : 256.0128,
              "storageSize" : 5586944,
              "numExtents" : 5,
              "nindexes" : 1,
              "lastExtentSize" : 4194304,
              "paddingFactor" : 1,
              "systemFlags" : 1,
              "userFlags" : 1,
              "totalIndexSize" : 654080,
              "indexSizes" : {
                      "_id_" : 654080
              },
              "ok" : 1
      }
      
      
      > insert 
      
      >db.gs_e89dfd94_7be7_44aa_b55b_6297cdfd9cbf.stats();
      {
              "ns" : "test007.gs_e89dfd94_7be7_44aa_b55b_6297cdfd9cbf",
              "count" : 20001,
              "size" : 5120752,
              "avgObjSize" : 256.02479876006197,
              "storageSize" : 5586944,
              "numExtents" : 5,
              "nindexes" : 1,
              "lastExtentSize" : 4194304,
              "paddingFactor" : 1,
              "systemFlags" : 1,
              "userFlags" : 1,
              "totalIndexSize" : 654080,
              "indexSizes" : {
                      "_id_" : 654080
              },
              "ok" : 1
      }
      

      ===================================================

      Is it a bug? finally my avgObjSize got double( 500B ) after around 20k insert operation,

            Assignee:
            Unassigned Unassigned
            Reporter:
            chimengwong@gmail.com Chimeng Wong
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: