<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:01:20 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[SERVER-2838] Dropping a collection does not free up disk space</title>
                <link>https://jira.mongodb.org/browse/SERVER-2838</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;I upgraded a mongodb server from 1.6.5 to 1.8.0, and dropped the collection after the upgrade. After dropping the collection, the disk space used on the machine was not reclaimed.&lt;/p&gt;

&lt;p&gt;show dbs;&lt;/p&gt;

&lt;p&gt;still shows the total size of the db as it was before the collection drop (~783GB).&lt;/p&gt;

&lt;p&gt;db.stats() shows the correct usage of the remaining collections:&lt;/p&gt;

&lt;p&gt;&quot;dataSize&quot; : 188678580624, (roughly 175 GB)&lt;/p&gt;

&lt;p&gt;db.stats() indicates that there are still 4 collections, even though there are only three remaining.&lt;/p&gt;


&lt;p&gt;&amp;gt; db.stats()&lt;br/&gt;
{&lt;br/&gt;
  &quot;db&quot; : &quot;xxxx&quot;,&lt;br/&gt;
  &quot;collections&quot; : 4,&lt;br/&gt;
  &quot;objects&quot; : 149504141,&lt;br/&gt;
  &quot;avgObjSize&quot; : 1262.0291275008897,&lt;br/&gt;
  &quot;dataSize&quot; : 188678580624,&lt;br/&gt;
  &quot;storageSize&quot; : 192878791072,&lt;br/&gt;
  &quot;numExtents&quot; : 127,&lt;br/&gt;
  &quot;indexes&quot; : 4,&lt;br/&gt;
  &quot;indexSize&quot; : 26608217472,&lt;br/&gt;
  &quot;fileSize&quot; : 841336487936,&lt;br/&gt;
  &quot;ok&quot; : 1&lt;br/&gt;
}&lt;br/&gt;
&amp;gt; show collections;&lt;br/&gt;
p_201103&lt;br/&gt;
p_201104&lt;br/&gt;
system.indexes&lt;/p&gt;


&lt;p&gt;&amp;gt; db.p_201103.stats()&lt;br/&gt;
{&lt;br/&gt;
  &quot;ns&quot; : &quot;xxxx.p_201103&quot;,&lt;br/&gt;
  &quot;count&quot; : 155304251,&lt;br/&gt;
  &quot;size&quot; : 196040069044,&lt;br/&gt;
  &quot;avgObjSize&quot; : 1262.2968642629105,&lt;br/&gt;
  &quot;storageSize&quot; : 198852279456,&lt;br/&gt;
  &quot;numExtents&quot; : 127,&lt;br/&gt;
  &quot;nindexes&quot; : 2,&lt;br/&gt;
  &quot;lastExtentSize&quot; : 1991168256,&lt;br/&gt;
  &quot;paddingFactor&quot; : 1.009999999999994,&lt;br/&gt;
  &quot;flags&quot; : 1,&lt;br/&gt;
  &quot;totalIndexSize&quot; : 27651591552,&lt;br/&gt;
  &quot;indexSizes&quot; : &lt;/p&gt;
{
    &quot;_id_&quot; : 6458263216,
    &quot;url_1&quot; : 21193328336
  }
&lt;p&gt;,&lt;br/&gt;
  &quot;ok&quot; : 1&lt;br/&gt;
}&lt;/p&gt;


&lt;p&gt;&amp;gt; db.p_201104.stats()&lt;br/&gt;
{&lt;br/&gt;
  &quot;ns&quot; : &quot;xxxx.p_201104&quot;,&lt;br/&gt;
  &quot;count&quot; : 0,&lt;br/&gt;
  &quot;size&quot; : 0,&lt;br/&gt;
  &quot;storageSize&quot; : 8192,&lt;br/&gt;
  &quot;numExtents&quot; : 1,&lt;br/&gt;
  &quot;nindexes&quot; : 2,&lt;br/&gt;
  &quot;lastExtentSize&quot; : 8192,&lt;br/&gt;
  &quot;paddingFactor&quot; : 1,&lt;br/&gt;
  &quot;flags&quot; : 1,&lt;br/&gt;
  &quot;totalIndexSize&quot; : 16384,&lt;br/&gt;
  &quot;indexSizes&quot; : &lt;/p&gt;
{
    &quot;_id_&quot; : 8192,
    &quot;url_1&quot; : 8192
  }
&lt;p&gt;,&lt;br/&gt;
  &quot;ok&quot; : 1&lt;br/&gt;
}&lt;/p&gt;


&lt;p&gt;&amp;gt; db.system.indexes.stats()   &lt;br/&gt;
{&lt;br/&gt;
  &quot;ns&quot; : &quot;xxxx.system.indexes&quot;,&lt;br/&gt;
  &quot;count&quot; : 4,&lt;br/&gt;
  &quot;size&quot; : 456,&lt;br/&gt;
  &quot;avgObjSize&quot; : 114,&lt;br/&gt;
  &quot;storageSize&quot; : 5120,&lt;br/&gt;
  &quot;numExtents&quot; : 1,&lt;br/&gt;
  &quot;nindexes&quot; : 0,&lt;br/&gt;
  &quot;lastExtentSize&quot; : 5120,&lt;br/&gt;
  &quot;paddingFactor&quot; : 1,&lt;br/&gt;
  &quot;flags&quot; : 0,&lt;br/&gt;
  &quot;totalIndexSize&quot; : 0,&lt;br/&gt;
  &quot;indexSizes&quot; : {&lt;/p&gt;

&lt;p&gt;  },&lt;br/&gt;
  &quot;ok&quot; : 1&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;This does not show anything for the dropped collection:&lt;/p&gt;

&lt;p&gt;db.system.namespaces.find().toArray()&lt;br/&gt;
[&lt;br/&gt;
      &lt;/p&gt;
{
              &quot;name&quot; : &quot;xxxx.system.indexes&quot;
      }
&lt;p&gt;,&lt;br/&gt;
      &lt;/p&gt;
{
              &quot;name&quot; : &quot;xxxx.p_201103&quot;
      }
&lt;p&gt;,&lt;br/&gt;
      &lt;/p&gt;
{
              &quot;name&quot; : &quot;xxxx.p_201103.$_id_&quot;
      }
&lt;p&gt;,&lt;br/&gt;
      &lt;/p&gt;
{
              &quot;name&quot; : &quot;xxxx.p_201103.$url_1&quot;
      }
&lt;p&gt;,&lt;br/&gt;
      &lt;/p&gt;
{
              &quot;name&quot; : &quot;xxxx.p_201104&quot;
      }
&lt;p&gt;,&lt;br/&gt;
      &lt;/p&gt;
{
              &quot;name&quot; : &quot;xxxx.p_201104.$_id_&quot;
      }
&lt;p&gt;,&lt;/p&gt;
      {
              &quot;name&quot; : &quot;xxxx.p_201104.$url_1&quot;
      }
&lt;p&gt;]&lt;/p&gt;

&lt;p&gt;There do not appear to be any error messages in the log from the drop:&lt;/p&gt;

&lt;p&gt;Mon Mar 21 20:16:28 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn5387&amp;#93;&lt;/span&gt; CMD: drop xxxx.p&lt;br/&gt;
Mon Mar 21 20:16:29 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn5387&amp;#93;&lt;/span&gt; query xxxx.$cmd ntoreturn:1 command: &lt;/p&gt;
{ drop: &quot;p&quot; }
&lt;p&gt; reslen:155 987ms&lt;/p&gt;

&lt;p&gt;The log seems normal for a few thousand lines after that (as far as I checked).&lt;/p&gt;

&lt;p&gt;The server has not been shut down since the upgrade to 1.8.0, and I&apos;m also running journaling on it now since the upgrade.&lt;br/&gt;
I have not changed the nssize.&lt;/p&gt;</description>
                <environment>linux 64-bit, ec2</environment>
        <key id="15294">SERVER-2838</key>
            <summary>Dropping a collection does not free up disk space</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="2" iconUrl="https://jira.mongodb.org/images/icons/priorities/critical.svg">Critical - P2</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="fields">Adam Fields</reporter>
                        <labels>
                    </labels>
                <created>Fri, 25 Mar 2011 17:33:55 +0000</created>
                <updated>Tue, 16 Nov 2021 15:37:18 +0000</updated>
                            <resolved>Fri, 25 Mar 2011 17:37:43 +0000</resolved>
                                    <version>1.8.0</version>
                                                    <component>Storage</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="26851" author="eliot" created="Fri, 25 Mar 2011 18:44:51 +0000"  >&lt;p&gt;Without a lot more information its kind of hard to say if its an issue or not.&lt;br/&gt;
For example, what size documents were there in the collection you dropped, how big was it, what size documents are you inserting now?&lt;/p&gt;</comment>
                            <comment id="26842" author="fields" created="Fri, 25 Mar 2011 18:10:32 +0000"  >&lt;p&gt;Sorry, yes - the disk space is not being freed back to the OS which is fine, but it does not appear to be (completely?) freed back to mongodb either. The amount of space being used in the data directory on the machine is still growing as new items are being written to the remaining collections, which should not be the case if mongodb has a giant pool of unused-but-allocated space to draw from, right?&lt;/p&gt;

&lt;p&gt;There is nothing else running on the box. &lt;/p&gt;

&lt;p&gt;Also, yes, the number of collections listed in db.stats() is different from that in system.namespaces.&lt;/p&gt;

&lt;p&gt;I&apos;ve just done some additional checking, and while it&apos;s trending upwards and definitely still growing, it does not seem to be growing quite as fast as I&apos;d expect from the data being written and it will periodically dip a bit lower before it starts growing again. The collection was dropped about 5 days ago - is it possible that the server is still doing some background cleanup and hasn&apos;t fully dropped the collection yet? It&apos;s under significant and constant write load (on the other collections).&lt;/p&gt;

&lt;p&gt;The byte count sampled periodically looks like this:&lt;/p&gt;

&lt;p&gt;926471920	mongodb_data&lt;br/&gt;
926479008	mongodb_data&lt;br/&gt;
926480568	mongodb_data&lt;br/&gt;
926501464	mongodb_data&lt;br/&gt;
926644360	mongodb_data&lt;br/&gt;
925650708	mongodb_data&lt;br/&gt;
925720740	mongodb_data&lt;/p&gt;</comment>
                            <comment id="26840" author="scotthernandez" created="Fri, 25 Mar 2011 17:51:56 +0000"  >&lt;p&gt;I don&apos;t think you want the disk space freed on the filesystem; you said that you were not seeing the space being reused within the existing files; That after you dropped the large collection new inserts caused the database file to grow. Is this still true, that the database file is growing?&lt;/p&gt;

&lt;p&gt;Also, the number of collections listed in db.stats() and system.namespaces are different; is that still true?&lt;/p&gt;</comment>
                            <comment id="26839" author="eliot" created="Fri, 25 Mar 2011 17:50:22 +0000"  >&lt;p&gt;No.  The space is re-used for other collections in that database, just not returned to file system.&lt;/p&gt;</comment>
                            <comment id="26838" author="sergei.tulentsev@gmail.com" created="Fri, 25 Mar 2011 17:44:03 +0000"  >&lt;p&gt;Does this mean that scenario when I frequently create / drop collections is inefficient?&lt;/p&gt;

&lt;p&gt;For example, analytics engine. I have a collection for each day&apos;s events. After I am done with processing and aggregating events for a day, I drop corresponding collection.&lt;/p&gt;</comment>
                            <comment id="26837" author="eliot" created="Fri, 25 Mar 2011 17:37:43 +0000"  >&lt;p&gt;This is correct behavior.&lt;br/&gt;
The only time mongo releases disk space is when you drop a database or do a repair.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>6.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 25 Mar 2011 17:37:43 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        12 years, 47 weeks, 5 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>luke.bonanomi@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            12 years, 47 weeks, 5 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Old_Backport</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10000"><![CDATA[No]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10032" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Operating System</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10020"><![CDATA[Linux]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>fields</customfieldvalue>
            <customfieldvalue>eliot</customfieldvalue>
            <customfieldvalue>scotthernandez</customfieldvalue>
            <customfieldvalue>sergei.tulentsev@gmail.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrp2lr:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hriefr:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>20991</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_22870" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Triagers</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrlkdz:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                    </customfields>
    </item>
</channel>
</rss>