<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:40:05 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>[GODRIVER-3104] Fix Bucket.Delete/DeleteContext returning ErrFileNotFound when chunks exist</title>
                <link>https://jira.mongodb.org/browse/GODRIVER-3104</link>
                <project id="14289" key="GODRIVER">Go Driver</project>
                    <description>&lt;h3&gt;&lt;a name=&quot;Context&quot;&gt;&lt;/a&gt;&lt;b&gt;Context&lt;/b&gt;&lt;/h3&gt;

&lt;p&gt;&lt;font color=&quot;#505f79&quot;&gt;Bucket.Delete and DeleteContext return an ErrFileNotFound error when the file document does not exist but chunks may have been deleted.&lt;/font&gt;&lt;/p&gt;

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

&lt;p&gt;&lt;font color=&quot;#505f79&quot;&gt;It should check the chunk error and only return ErrFileNotFound if no file or chunk documents were found.&lt;/font&gt;&lt;/p&gt;

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

&lt;p&gt;&lt;font color=&quot;#505f79&quot;&gt;Why do this?&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;After a failed upload you can have chunks with no file document in mongodb using gridfs. The Delete methods should be able to clean this up without erroring. Also returning an error when Delete did in fact delete/fully cleanup a file doesn&apos;t make any sense.&lt;/p&gt;
&lt;h3&gt;&lt;a name=&quot;Definitionofdone&quot;&gt;&lt;/a&gt;&lt;b&gt;Definition of done&lt;/b&gt;&lt;/h3&gt;

&lt;p&gt;&lt;font color=&quot;#505f79&quot;&gt;What must be done to consider the task complete?&lt;/font&gt;&lt;/p&gt;

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

&lt;p&gt;&lt;font color=&quot;#505f79&quot;&gt;A gridfs upload can fail and leave chunks in the chunks collection without a corresponding file document. If you call Delete or DeleteContext using the file id of these chunks then an error is returned that the file doesn&apos;t exist. It should return nil instead when these existing chunks are cleaned up. ErrFileNotFound should only be returned if both the file document and chunks do not exist.&lt;/font&gt;&lt;/p&gt;
&lt;h3&gt;&lt;a name=&quot;Pitfalls&quot;&gt;&lt;/a&gt;&lt;b&gt;Pitfalls&lt;/b&gt;&lt;/h3&gt;

&lt;p&gt;&lt;font color=&quot;#505f79&quot;&gt;Existing code could potentially be relying on this and require a version bump. However I believe it&apos;s unlikely as most code probably ignores the error from delete when used for cleanup after a failed file upload.&lt;/font&gt;&lt;/p&gt;

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

&lt;p&gt;&lt;font color=&quot;#505f79&quot;&gt;See &lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/blob/v1/mongo/gridfs/bucket.go#L277&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-go-driver/blob/v1/mongo/gridfs/bucket.go#L277&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;

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

&lt;p&gt;&lt;font color=&quot;#505f79&quot;&gt;The chunks error is ignored. This should be checked and if nil/deleted chunk documents and the file error is ErrFileNotFound then no error should be returned.&lt;/font&gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="2556251">GODRIVER-3104</key>
            <summary>Fix Bucket.Delete/DeleteContext returning ErrFileNotFound when chunks exist</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</priority>
                        <status id="11156" iconUrl="https://jira.mongodb.org/images/icons/statuses/generic.png" description="">Waiting for Reporter</status>
                    <statusCategory id="4" key="indeterminate" colorName="inprogress"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="preston.vasquez@mongodb.com">Preston Vasquez</assignee>
                                    <reporter username="epelc@greatcloak.com">Ed Pelc</reporter>
                        <labels>
                    </labels>
                <created>Wed, 24 Jan 2024 20:36:21 +0000</created>
                <updated>Wed, 7 Feb 2024 13:11:05 +0000</updated>
                                                                                                <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="6074736" author="dbeng-pm-bot" created="Wed, 7 Feb 2024 13:11:05 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=epelc%40greatcloak.com&quot; class=&quot;user-hover&quot; rel=&quot;epelc@greatcloak.com&quot;&gt;epelc@greatcloak.com&lt;/a&gt;! &lt;a href=&quot;https://jira.mongodb.org/browse/GODRIVER-3104&quot; title=&quot;Fix Bucket.Delete/DeleteContext returning ErrFileNotFound when chunks exist&quot; class=&quot;issue-link&quot; data-issue-key=&quot;GODRIVER-3104&quot;&gt;GODRIVER-3104&lt;/a&gt; is awaiting your response. &lt;/p&gt;

&lt;p&gt;If this is still an issue for you, please open Jira to review the latest status and provide your feedback. Thanks!&lt;/p&gt;</comment>
                            <comment id="6054565" author="JIRAUSER1265158" created="Wed, 31 Jan 2024 01:04:08 +0000"  >&lt;p&gt;Hey &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=epelc%40greatcloak.com&quot; class=&quot;user-hover&quot; rel=&quot;epelc@greatcloak.com&quot;&gt;epelc@greatcloak.com&lt;/a&gt;, thanks for reaching out. &lt;tt&gt;ErrFileNotFound&lt;/tt&gt; serves as a &lt;a href=&quot;https://en.wikipedia.org/wiki/Sentinel_event&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;sentinel&lt;/a&gt; (io.EOF, for example) that signals to the user that a gridfs operation occurred without corresponding files. The occurrence of this SE indicates a potential inconsistency in the data storage, i.e. the absence of corresponding files might suggest a problem in the data structure or storage process (like losing a connection mid upsert). At the very least, this may be something a user needs to log. For this reason, removing the error in v1 would be backwards breaking, as you note.&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;err := b.Delete(ctx, fileID)&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;if errors.Is(err, gridfs.ErrFileNotFound) {&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    log.Infof(&quot;orphaned chunks for filedID %q deleted&quot;, fileID)&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;} else if err != nil {&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    return fmt.Errorf(&quot;failed to delete: %w&quot;, err)&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-163&quot; title=&quot;GridFS clean method Interrupted GridFS inserts leave unlinked entries in the .chunks collection - Some way to clean those up would be helpful&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-163&quot;&gt;&lt;del&gt;SERVER-163&lt;/del&gt;&lt;/a&gt; notes that there is no safe way to avoid this problem server-side. &lt;/p&gt;</comment>
                            <comment id="6039127" author="epelc@greatcloak.com" created="Wed, 24 Jan 2024 20:40:40 +0000"  >&lt;p&gt;Sorry for the poor formatting. I submitted before finishing editing.&lt;/p&gt;

&lt;p&gt;&quot;A gridfs upload can fail and leave chunks in the chunks collection without a corresponding file document. If you call Delete or DeleteContext using the file id of these chunks then an error is returned that the file doesn&apos;t exist. It should return nil instead when these existing chunks are cleaned up. ErrFileNotFound should only be returned if both the file document and chunks do not exist.&quot;&lt;/p&gt;

&lt;p&gt;should be at the top and is the main synopsis. It seems Jira doesn&apos;t let you edit the description.&lt;/p&gt;</comment>
                            <comment id="6039105" author="dbeng-pm-bot" created="Wed, 24 Jan 2024 20:36:24 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=epelc%40greatcloak.com&quot; class=&quot;user-hover&quot; rel=&quot;epelc@greatcloak.com&quot;&gt;epelc@greatcloak.com&lt;/a&gt;, thank you for reporting this issue! The team will look into it and get back to you soon. &lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                    <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="26437"><![CDATA[Go Drivers]]></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_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|i2rob0:</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>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>