[SERVER-10998] avgObjSize keep enlarging when setup usePowerOf2Sizes Created: 02/Oct/13 Updated: 10/Dec/14 Resolved: 07/Oct/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Storage |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Chimeng Wong | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | avgObjSize, usePowerOf2Sizes | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Redhat 5.2 64bit, mongoDB 2.4.6, ruby 1.9.3 |
||
| Operating System: | Linux |
| Participants: |
| Description |
|
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
=================================================== Is it a bug? finally my avgObjSize got double( 500B ) after around 20k insert operation, |
| Comments |
| Comment by Daniel Pasette (Inactive) [ 09/Oct/13 ] |
|
You set up powerOf2Size on the collection, not on the document. You can do it at any time, because it only affects subsequent allocations in the collection. If you insert many documents where your document is > 128b and < 256b then the avgObjSize should remain at 256b. |
| Comment by Chimeng Wong [ 07/Oct/13 ] |
|
Hi Dan, I still have a question, assume my each doc is 260Bytes ( more than 256Bytes ), keep insert and setup powerOf2Size on each new document. I know the avgObjSize will be enlarged by itself, but will the avgObjSize stop in 512Bytes? |
| Comment by Daniel Pasette (Inactive) [ 07/Oct/13 ] |
|
That's correct. |
| Comment by Chimeng Wong [ 07/Oct/13 ] |
|
Hi Dan, So powerOf2Size option will not effect on inserted doc, only affect on future insert right? |
| Comment by Daniel Pasette (Inactive) [ 07/Oct/13 ] |
|
avgObjSize is calculated by dividing the size by the count. It can be affected by the usePowerOf2Sizes option depending on the documents which are inserted after it's turned on. If all of the new documents you are inserting are larger than 256 bytes, mongod will allocate the next power of 2 size (512 bytes) for these new documents. Eventually, this will increase your average document size accordingly. |
| Comment by Chimeng Wong [ 02/Oct/13 ] |
|
Sorry, title should remove using Ruby |