[SERVER-594] Unnecessary allocation of disk space Created: 02/Feb/10  Updated: 12/Jul/16  Resolved: 08/Feb/10

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 1.3.1
Fix Version/s: 1.3.2

Type: Bug Priority: Major - P3
Reporter: Yun Huang Yong Assignee: Aaron Staple
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

db version v1.3.1, pdfile version 4.5
sys info: Linux rosehip 2.6.24-26-xen #1 SMP Tue Dec 1 19:54:57 UTC 2009 x86_64 BOOST_LIB_VERSION=1_38


Attachments: File disk_usage.rb     File mongod.log.gz     File output-5k-no-int.txt.gz    
Participants:

 Description   

Running the attached script results in:

  • disk_usage.2 created in run #96 (~5 minutes runtime)
  • disk_usage.3 created in run #375 (~17 minutes runtime)
  • disk_usage.4 created in run #1009 (~44 minutes runtime)
  • disk_usage.5 created in run #2276 (~99 minutes runtime)

The script is inserting roughly 20MB worth of 5000* byte strings in each run.

*actually 4990 to 5000 bytes, this appears to be significant as using fixed strings of 5000 bytes didn't cause this issue.

The rename appears to be significant - when I took it out I couldn't re-create this issue.

Attached the output of this script during my run as well as mongod.log.
Note that mongod.log times are in GMT however the output times are in AEST (GMT+11). Sorry about that.



 Comments   
Comment by auto [ 08/Feb/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-594 allocate first extent of new collection from free list
http://github.com/mongodb/mongo/commit/a01100d8e55d14dc78b111d8516f644583b80de5

Comment by Eliot Horowitz (Inactive) [ 07/Feb/10 ]

decision was that we can change behavior and take first extent off free list.

Comment by Aaron Staple [ 02/Feb/10 ]

It looks like the first extent for a new collection is allocated from new space in the file, rather than from the free list:

NamespaceDetails *d = nsdetails(ns);
if ( d == 0 )

{ addNewNamespaceToCatalog(ns); /* todo: shouldn't be in the namespace catalog until after the allocations here work. also if this is an addIndex, those checks should happen before this! */ // This creates first file in the database. cc().database()->newestFile()->createExtent(ns, initialExtentSize(len)); d = nsdetails(ns); if ( !god ) ensureIdIndexForNewNs(ns); }

I ran Yun's test with some extra debugging and saw that the new extents were being created in the above createExtent() call.

Dwight, do we want to change this behavior?

Generated at Thu Feb 08 02:54:37 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.