<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:11:22 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-6326] Batch inserts in C++</title>
                <link>https://jira.mongodb.org/browse/SERVER-6326</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;This is a question from one of our customers.  Sorry for the late notice, we have a meeting with them at 2pm today.&lt;/p&gt;


&lt;p&gt;I had a question (possibly bug report) about the MongoDB C++ driver.  We wanted to switch from using:&lt;/p&gt;

&lt;p&gt;insert(const string &amp;amp;ns, BSONObj obj, int flags)&lt;/p&gt;

&lt;p&gt;to the &quot;batched&quot; version:&lt;/p&gt;

&lt;p&gt;insert(const string &amp;amp;ns, const vector&amp;lt;BSONObj&amp;gt; &amp;amp;v, int flags)&lt;/p&gt;

&lt;p&gt;for performance reasons. &lt;/p&gt;

&lt;p&gt;However, we hit an issue pretty quickly. Under the covers, the version which takes the vector uses a BufBuilder to build up the request to send.  In versions 2.0.x of the API, the growth algorithm for the buffer inside BufBuilder means it does not grow in a particularly predictable fashion and we found ourselves exceeding the buffer&apos;s 64MB limit pretty consistently.  Consequently, we switched to using BufBuilder directly ourselves and effectively reverse engineering the growth algorithm to make sure we stuffed as much into it as possible.&lt;/p&gt;

&lt;p&gt;I see the growth algorithm has been changed in 2.1.0 to ensure the buffer&apos;s size grows in powers of two which means I can remove the reverse engineering from our code. &lt;/p&gt;

&lt;p&gt;However, there seems to be a loophole.  The BufBuilder constructor takes an int argument which is the buffer&apos;s initial size and there is no maximum size validation on this.  Therefore, I could create it to be larger than 64MB and as long as my appends never cause it to grow, it won&apos;t throw any errors about  the size. &lt;/p&gt;

&lt;p&gt;Is this loophole intentional or is this a bug?&lt;br/&gt;
What are the potential downsides to us exploiting it?&lt;/p&gt;</description>
                <environment></environment>
        <key id="43544">SERVER-6326</key>
            <summary>Batch inserts in C++</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="4">Incomplete</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="ctindel">Chad Tindel</reporter>
                        <labels>
                            <label>cxxcopy</label>
                    </labels>
                <created>Fri, 6 Jul 2012 15:09:16 +0000</created>
                <updated>Fri, 24 Feb 2017 14:27:45 +0000</updated>
                            <resolved>Fri, 24 Feb 2017 14:27:45 +0000</resolved>
                                                                    <component>Internal Client</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="1508720" author="milkie" created="Fri, 24 Feb 2017 14:27:45 +0000"  >&lt;p&gt;Currently, the legacy C++ driver is currently only getting critical bug/security fixes, not new features.&lt;br/&gt;
We encourage users to migrate to the new &apos;mongocxx&apos; driver for much greater stability, configurability and support for new MongoDB server features.&lt;br/&gt;
See the C++ driver docs site for details on mongocxx.&lt;/p&gt;</comment>
                            <comment id="140969" author="greg_10gen" created="Mon, 9 Jul 2012 18:57:10 +0000"  >&lt;p&gt;Another alternative would be to recompile mongodb with a different max size constant for the BufBuilder.  &lt;/p&gt;</comment>
                            <comment id="140965" author="greg_10gen" created="Mon, 9 Jul 2012 18:48:23 +0000"  >&lt;p&gt;It&apos;s not intentional.  Downsides to exploiting it are basically the downsides to exploiting unintentional behavior anywhere - it&apos;s very much not supported now or in the future.  From a cursory look, it seems like it would work ok, but again, there could be dragons.&lt;/p&gt;

&lt;p&gt;Is there a reason to suspect that batching &amp;gt;64MB will give a significant performance boost?  Extremely small documents?&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_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Mon, 9 Jul 2012 18:48:23 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        6 years, 50 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>false</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>milkie@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            6 years, 50 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="10026"><![CDATA[ALL]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>ctindel</customfieldvalue>
            <customfieldvalue>milkie@mongodb.com</customfieldvalue>
            <customfieldvalue>greg_10gen</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrnx6v:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>4840</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|hszxef:</customfieldvalue>

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