<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:53:51 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>[JAVA-1125] Improve GridFS.remove(query) method </title>
                <link>https://jira.mongodb.org/browse/JAVA-1125</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;remove(query) on GridFS is currently performed by :&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;first issuing a select on files bucket&lt;/li&gt;
	&lt;li&gt;then for each file remove it and remove the associated chunks by files_id&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;First I think this kind of linked removal, should be fully handled by the server and not by the client, as this is a server feature.&lt;br/&gt;
Moreover the current implementation can result in thousands of different requests, and doesn&apos;t insure consistency anyway.&lt;/p&gt;

&lt;p&gt;Thus the method efficiency could be improved by performing at most two requests, one on &quot;files&quot; collection using the query and the other on &quot;chunks&quot; collection using a in clause on files_id previously selected. &lt;/p&gt;

&lt;p&gt;Tests made on a &quot;50K files&quot; bucket have showed that the remove time for 31K files was dropping from 385000ms to 825ms only (465x improvement)&lt;/p&gt;

&lt;p&gt;PR #171 has been issued on github : &lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/pull/171&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/pull/171&lt;/a&gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="115441">JAVA-1125</key>
            <summary>Improve GridFS.remove(query) method </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="2">Won&apos;t Fix</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="finalspy">PETIT Yann</reporter>
                        <labels>
                    </labels>
                <created>Thu, 27 Feb 2014 20:40:58 +0000</created>
                <updated>Tue, 5 Dec 2017 15:37:14 +0000</updated>
                            <resolved>Thu, 19 Nov 2015 10:59:43 +0000</resolved>
                                    <version>2.12.0</version>
                                                    <component>GridFS</component>
                                        <votes>1</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="1092779" author="ross@10gen.com" created="Thu, 19 Nov 2015 10:59:43 +0000"  >&lt;p&gt;As this ticket interacts with the legacy and effectively deprecated GridFS implementation I&apos;m closing it as &quot;Won&apos;t Fix&quot;. &lt;/p&gt;

&lt;p&gt;There is a new &lt;a href=&quot;https://github.com/mongodb/specifications/blob/master/source/gridfs/gridfs-spec.rst#file-deletion&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;GridFS spec&lt;/a&gt; which specifically doesn&apos;t have a &lt;tt&gt;remove(query)&lt;/tt&gt; method, due to complexities that can happen if there were to be an error when deleting the data.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=finalspy&quot; class=&quot;user-hover&quot; rel=&quot;finalspy&quot;&gt;finalspy&lt;/a&gt; if you feel this is a mistake and it should be included for all drivers - then please can I ask you to open a &lt;a href=&quot;https://jira.mongodb.org/browse/DRIVERS&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;Drivers ticket&lt;/a&gt;? And we can continue the conversation there.&lt;/p&gt;</comment>
                            <comment id="571300" author="finalspy" created="Fri, 2 May 2014 23:25:32 +0000"  >&lt;p&gt;A new PR has been issued against branch 3.0.X this time.&lt;br/&gt;
It improves the previous solution by keeping the default behavior but allowing to pass a new parameter to force &quot;bulk&quot; remove.&lt;/p&gt;

&lt;p&gt;I also added 2 tests which generate each 100 gridfs files with several chunks and remove them all using one time the legacy behavior and the other the &quot;bulk remove&quot;. On my computer (single mongod 2.6 no shard, no replica) it results in a 2x to 4x improvement on 100 files. The largest the number of removed files is, the more efficient this new way to remove files/chunks is.&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;Fixed by https://github.com/mongodb/mongo-java-driver/pull/192 &amp;#93;&lt;/span&gt;&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrtib3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>86057</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>