<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:04:34 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-43953] Drop backing BSON in Document when possible</title>
                <link>https://jira.mongodb.org/browse/SERVER-43953</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Documents store a backing BSON object in addition to a cache of fields which have already been examined. This means they may be ~2x the size of the actual user document they represent. This makes copying them slower (we call getOwned() when crossing the find/agg membrane), and increases memory consumption. We should make an effort to drop this backing BSON when it is no longer necessary to hold onto. &lt;/p&gt;

&lt;p&gt;If this ticket gets scheduled, someone should think very hard about what conditions the backing BSON can be dropped are. I would start with the following:&lt;/p&gt;

&lt;p&gt;1) The backing BSON has been fully traversed (&lt;tt&gt;DocumentStorage::_bsonIt&lt;/tt&gt; has reached the end)&lt;br/&gt;
AND&lt;br/&gt;
2) The metadata has been loaded from the backing BSON &lt;em&gt;or&lt;/em&gt; the backing BSON has no metadata&lt;br/&gt;
AND&lt;br/&gt;
3) The original BSON will not be returned to the user. i.e. the Document has been modified, will be modified, or will be discarded. If this is the case then we&apos;ll never take the toBson() fast path which uses the original backing BSON.&lt;/p&gt;

&lt;p&gt;Point (3) is pretty broad, but for a first implementation we could only consider cases where the Document is already modified.&lt;/p&gt;</description>
                <environment></environment>
        <key id="966955">SERVER-43953</key>
            <summary>Drop backing BSON in Document when possible</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</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="12300">Won&apos;t Do</resolution>
                                        <assignee username="ian.boros@mongodb.com">Ian Boros</assignee>
                                    <reporter username="ian.boros@mongodb.com">Ian Boros</reporter>
                        <labels>
                            <label>qexec-team</label>
                    </labels>
                <created>Thu, 10 Oct 2019 21:41:30 +0000</created>
                <updated>Thu, 19 Mar 2020 19:52:30 +0000</updated>
                            <resolved>Thu, 19 Mar 2020 19:52:30 +0000</resolved>
                                                                    <component>Querying</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="2988128" author="david.storch" created="Thu, 19 Mar 2020 19:19:18 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=ian.boros&quot; class=&quot;user-hover&quot; rel=&quot;ian.boros&quot;&gt;ian.boros&lt;/a&gt; I&apos;m happy to close this ticket as &quot;Won&apos;t Do&quot;. Thanks for taking a look.&lt;/p&gt;</comment>
                            <comment id="2962771" author="ian.boros" created="Wed, 11 Mar 2020 04:09:54 +0000"  >&lt;p&gt;Now that DocumentStorage no longer maintains a BSONObjIterator over the backing BSON (it performs lookups from the beginning each time), condition (1) does not make sense. We could instead use:&lt;/p&gt;

&lt;p&gt;(1) The number of elements in the cache is the same as the number of elements in the BSONObj. We can inexpensively get the size of the BSONObj &lt;a href=&quot;https://github.com/mongodb/mongo/blob/504c22fbb154d0159cdff615642353f1318dbd36/src/mongo/db/exec/document_value/document.cpp#L163-L167&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;, as if that loop never completes, the size of the cache will not be the size of the BSONObj anyway.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;With that said, I don&apos;t think this will provide much benefit. How often is to run an aggregation which references every field of the document and &lt;em&gt;does not&lt;/em&gt; have an inclusion projection or dependency set? (which would cause us to create a fully-cached document). I&apos;m going to talk with Dave after he gets back but I think we should close this as &quot;Won&apos;t Do&quot;.&lt;/p&gt;</comment>
                            <comment id="2476654" author="ian.boros" created="Thu, 10 Oct 2019 21:46:56 +0000"  >&lt;p&gt;Regarding point (3): In the future we could do a coarse analysis of a pipeline to determine whether the original document will be modified or discarded and, if so, construct the Document with a flag that indicates it can drop its backing BSON earlier. For example, any pipeline with a $group, inclusion projection, $lookup, $redact, $replaceRoot fit this case. If the backing BSON can be dropped in the PlanStage layer, then we don&apos;t need to copy when going to DocumentSource land only to throw it away later.&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>3.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>4.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Thu, 12 Dec 2019 21:54:09 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        3 years, 46 weeks, 6 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>ian.boros@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            3 years, 46 weeks, 6 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>david.storch@mongodb.com</customfieldvalue>
            <customfieldvalue>ian.boros@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hvx1gn:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="3285">Query 2019-11-18</customfieldvalue>
    <customfieldvalue id="3286">Query 2019-12-02</customfieldvalue>
    <customfieldvalue id="3496">Query 2020-03-23</customfieldvalue>
    <customfieldvalue id="3497">Query 2020-04-06</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|hvwnpz:</customfieldvalue>

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