<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:22:46 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-10280] Too much database space with a queue collection</title>
                <link>https://jira.mongodb.org/browse/SERVER-10280</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;We have a database with some collection and we use these collection like a queue. We insert documents in the queue with db.&amp;lt;collection&amp;gt;.insert() and we extract them with db.&amp;lt;collection&amp;gt;.findAndModify({query:{},sort:&lt;/p&gt;
{&quot;_id&quot;:1}
&lt;p&gt;,remove:true})&lt;/p&gt;

&lt;p&gt;The problem is that we observe that the database size is bigger and bigger even when the size of the collection is small.&lt;/p&gt;

&lt;p&gt;Now, we have the following situation:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Database size&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;rsstuff:SECONDARY&amp;gt; db.stats(1024*1024)&lt;br/&gt;
{&lt;br/&gt;
        &quot;db&quot; : &quot;colas&quot;,&lt;br/&gt;
        &quot;collections&quot; : 14,&lt;br/&gt;
        &quot;objects&quot; : 26529,&lt;br/&gt;
        &quot;avgObjSize&quot; : 269721.5101963889,&lt;br/&gt;
        &quot;dataSize&quot; : 6823,&lt;br/&gt;
        &quot;storageSize&quot; : 119875,&lt;br/&gt;
        &quot;numExtents&quot; : 180,&lt;br/&gt;
        &quot;indexes&quot; : 13,&lt;br/&gt;
        &quot;indexSize&quot; : 0,&lt;br/&gt;
        &quot;fileSize&quot; : 126851,&lt;br/&gt;
        &quot;nsSizeMB&quot; : 16,&lt;br/&gt;
        &quot;dataFileVersion&quot; : &lt;/p&gt;
{
                &quot;major&quot; : 4,
                &quot;minor&quot; : 5
        }
&lt;p&gt;,&lt;br/&gt;
        &quot;ok&quot; : 1&lt;br/&gt;
}&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Script to see size and storageSize&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;rsstuff:SECONDARY&amp;gt; escala=1024*1024&lt;br/&gt;
1048576&lt;br/&gt;
rsstuff:SECONDARY&amp;gt; mdb = db.getSiblingDB(&quot;colas&quot;);&lt;br/&gt;
colas&lt;br/&gt;
rsstuff:SECONDARY&amp;gt; mdb.getCollectionNames().forEach(function(c) &lt;/p&gt;
{s = mdb[c].stat
s(escala); print(s.ns + &quot; --&amp;gt; Count:&quot; + s.count + &quot;; Size(MB):&quot; + s.size + &quot;; Si
ze in Disk(MB):&quot; + s.storageSize)}
&lt;p&gt;)&lt;br/&gt;
colas.Queue_FlightsTouroperationCache --&amp;gt; Count:0; Size(MB):0; Size in Disk(MB):&lt;br/&gt;
73&lt;br/&gt;
colas.Queue_FlightsTouroperationPurchase --&amp;gt; Count:0; Size(MB):0; Size in Disk(M&lt;br/&gt;
B):0&lt;br/&gt;
colas.Queue_FlightsTouroperationShowcase --&amp;gt; Count:0; Size(MB):0; Size in Disk(M&lt;br/&gt;
B):0&lt;br/&gt;
colas.Queue_HotelsTouroperationCache --&amp;gt; Count:25000; Size(MB):6823; Size in Dis&lt;br/&gt;
k(MB):21528&lt;br/&gt;
colas.Queue_HotelsTouroperationPurchase --&amp;gt; Count:901; Size(MB):6; Size in Disk(&lt;br/&gt;
MB):42004&lt;br/&gt;
colas.Queue_HotelsTouroperationShowcase --&amp;gt; Count:320; Size(MB):2; Size in Disk(&lt;br/&gt;
MB):28674&lt;br/&gt;
colas.Queue_PackagesTouroperationPRODUCT_FLIGHTHOTEL --&amp;gt; Count:168; Size(MB):1;&lt;br/&gt;
Size in Disk(MB):8965&lt;br/&gt;
colas.Queue_PackagesTouroperationPRODUCT_HOTEL --&amp;gt; Count:409; Size(MB):3; Size i&lt;br/&gt;
n Disk(MB):18626&lt;br/&gt;
colas.Queue_PackagesTouroperationProduct_Flight --&amp;gt; Count:0; Size(MB):0; Size in&lt;br/&gt;
 Disk(MB):0&lt;br/&gt;
colas.Queue_PackagesTouroperationProduct_Flight_OW --&amp;gt; Count:0; Size(MB):0; Size&lt;br/&gt;
 in Disk(MB):0&lt;br/&gt;
colas.Queue_PackagesTouroperationSHOWCASE --&amp;gt; Count:0; Size(MB):0; Size in Disk(&lt;br/&gt;
MB):0&lt;br/&gt;
colas.system.indexes --&amp;gt; Count:13; Size(MB):0; Size in Disk(MB):0&lt;br/&gt;
colas.system.users --&amp;gt; Count:2; Size(MB):0; Size in Disk(MB):0 &lt;/p&gt;</description>
                <environment>rsstuff:SECONDARY&amp;gt; db.serverBuildInfo()&lt;br/&gt;
{&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot;version&amp;quot; : &amp;quot;2.4.5&amp;quot;,&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot;gitVersion&amp;quot; : &amp;quot;a2ddc68ba7c9cee17bfe69ed840383ec3506602b&amp;quot;,&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot;sysInfo&amp;quot; : &amp;quot;windows sys.getwindowsversion(major=6, minor=1, build=7601,&lt;br/&gt;
&amp;nbsp;platform=2, service_pack=&amp;#39;Service Pack 1&amp;#39;) BOOST_LIB_VERSION=1_49&amp;quot;,&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot;loaderFlags&amp;quot; : &amp;quot;/nologo /LTCG /DEBUG /LARGEADDRESSAWARE /NODEFAULTLIB:M&lt;br/&gt;
SVCPRT&amp;quot;,&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot;compilerFlags&amp;quot; : &amp;quot;/TP /nologo /EHsc /W3 /wd4355 /wd4800 /wd4267 /wd4244&lt;br/&gt;
&amp;nbsp;/Z7 /errorReport:none /O2 /Oy- /MT /GL&amp;quot;,&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot;allocator&amp;quot; : &amp;quot;system&amp;quot;,&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot;versionArray&amp;quot; : [&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2,&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;4,&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;5,&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;],&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot;javascriptEngine&amp;quot; : &amp;quot;V8&amp;quot;,&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot;bits&amp;quot; : 64,&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot;debug&amp;quot; : false,&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot;maxBsonObjectSize&amp;quot; : 16777216,&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot;ok&amp;quot; : 1&lt;br/&gt;
}</environment>
        <key id="83030">SERVER-10280</key>
            <summary>Too much database space with a queue collection</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</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="david.verdejo@logitravel.com">David Verdejo</reporter>
                        <labels>
                            <label>database</label>
                            <label>queue</label>
                            <label>space</label>
                    </labels>
                <created>Mon, 22 Jul 2013 07:22:47 +0000</created>
                <updated>Mon, 11 Jul 2016 17:38:09 +0000</updated>
                            <resolved>Sun, 15 Dec 2013 19:35:56 +0000</resolved>
                                    <version>2.4.5</version>
                                                    <component>Storage</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="386752" author="dan@10gen.com" created="Tue, 23 Jul 2013 04:45:15 +0000"  >&lt;p&gt;In some workloads, mongodb can be susceptible to fragmentation and inefficient re-use of freed space in the collection.  This is helped by using the powerOf2Sizes option on these collections.  This can keep storage size steady in delete-heavy workloads.&lt;/p&gt;

&lt;p&gt;See: &lt;a href=&quot;http://docs.mongodb.org/manual/reference/command/collMod/#usePowerOf2Sizes&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://docs.mongodb.org/manual/reference/command/collMod/#usePowerOf2Sizes&lt;/a&gt;&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>1.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Tue, 23 Jul 2013 04:45:15 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        10 years, 30 weeks, 1 day 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>ramon.fernandez@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            10 years, 30 weeks, 1 day 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="10022"><![CDATA[Windows]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>dan@mongodb.com</customfieldvalue>
            <customfieldvalue>david.verdejo@logitravel.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrmm5r:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>75878</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_10750" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Steps To Reproduce</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>&lt;p&gt;Create a collection and insert a lot of documents and create a process to extract with findAndModify.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;//server&lt;/p&gt;

&lt;p&gt;var dormir=1000;&lt;br/&gt;
var umbral=1000;&lt;/p&gt;

&lt;p&gt;function sleep(milliseconds) {&lt;br/&gt;
	var start = new Date().getTime();&lt;br/&gt;
	to=0;&lt;br/&gt;
	  for (var i = 0; (i &amp;lt; 1e7 &amp;amp;&amp;amp; to==0); i++) {&lt;br/&gt;
		if ((new Date().getTime() - start) &amp;gt; milliseconds)&lt;/p&gt;
{
		 to=1;
		}&lt;br/&gt;
	  }&lt;br/&gt;
}&lt;br/&gt;
&lt;br/&gt;
var i=0;&lt;br/&gt;
while (i&amp;lt;umbral) { &lt;br/&gt;
	y =&quot;Message &quot; + i; &lt;br/&gt;
	db.queue.insert({_id:i,message:y}); &lt;br/&gt;
	i++; &lt;br/&gt;
	sleep(dormir);&lt;br/&gt;
};&lt;br/&gt;
&lt;br/&gt;
//client&lt;br/&gt;
&lt;br/&gt;
var dormir=100;&lt;br/&gt;
var umbral=1;&lt;br/&gt;
&lt;br/&gt;
function sleep(milliseconds) {&lt;br/&gt;
	var start = new Date().getTime();&lt;br/&gt;
	to=0;&lt;br/&gt;
	  for (var i = 0; (i &amp;lt; 1e7 &amp;amp;&amp;amp; to==0); i++) {&lt;br/&gt;
		if ((new Date().getTime() - start) &amp;gt; milliseconds){		 to=1;		}
&lt;p&gt;	  }&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;var i=0;&lt;br/&gt;
while (i&amp;lt;umbral) { &lt;br/&gt;
	y =&quot;Message &quot; + i; &lt;br/&gt;
	res=db.queue.findAndModify({query:{},sort:&lt;/p&gt;
{&quot;_id&quot;:1}
&lt;p&gt;,remove:true});&lt;br/&gt;
	printjson(res);&lt;br/&gt;
	sleep(dormir);&lt;br/&gt;
};&lt;/p&gt;</customfieldvalue>

                        </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|hspedr:</customfieldvalue>

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