<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:10:52 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>[CDRIVER-872] GridFS files can be written to after saving</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-872</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;We allow&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;mongoc_gridfs_file_save (file);&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;mongoc_gridfs_file_writev (file, ...);&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;Should this be prohibited?&lt;/p&gt;</description>
                <environment>All</environment>
        <key id="230999">CDRIVER-872</key>
            <summary>GridFS files can be written to after saving</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</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="kyle.suarez@mongodb.com">Kyle Suarez</reporter>
                        <labels>
                            <label>gridfs</label>
                    </labels>
                <created>Tue, 22 Sep 2015 17:30:54 +0000</created>
                <updated>Wed, 11 Sep 2019 19:04:01 +0000</updated>
                            <resolved>Thu, 1 Oct 2015 16:58:27 +0000</resolved>
                                                    <fixVersion>1.3.0-beta0</fixVersion>
                                    <component>GridFS</component>
                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="1048872" author="bjori" created="Thu, 1 Oct 2015 17:00:03 +0000"  >&lt;p&gt;Not sure why the other commit didn&apos;t show up.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/a7ea97eb3f64535ef4e6e6f15f8a144d388beaa2&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/a7ea97eb3f64535ef4e6e6f15f8a144d388beaa2&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1048830" author="xgen-internal-githook" created="Thu, 1 Oct 2015 16:26:00 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;ksuarz&apos;, u&apos;name&apos;: u&apos;Kyle Suarez&apos;, u&apos;email&apos;: u&apos;ksuarz@gmail.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-511&quot; title=&quot;Files written to GridFS must be saved before being read back&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-511&quot;&gt;&lt;del&gt;CDRIVER-511&lt;/del&gt;&lt;/a&gt; tests don&apos;t save between reads/writes&lt;/p&gt;

&lt;p&gt;This also makes progress towards fulfilling &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-872&quot; title=&quot;GridFS files can be written to after saving&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-872&quot;&gt;&lt;del&gt;CDRIVER-872&lt;/del&gt;&lt;/a&gt;.&lt;br/&gt;
Branch: 1.3.0-dev&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/e7a7d9c2bce8f8b968f9ee05c5efc9ea33c37d38&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/e7a7d9c2bce8f8b968f9ee05c5efc9ea33c37d38&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1040170" author="jsbattig@convey.com" created="Tue, 22 Sep 2015 19:39:45 +0000"  >&lt;p&gt;Jesse, simply put: the more flexibility provided, the better for us. We prefer the ability to read/write liberally to a GridFS file from a common GridFS file object, as if it were a traditional Stream object. Anything different than that will force us to implement sub-optimal approaches to mimic bi-directional stream operations.&lt;/p&gt;

&lt;p&gt;We have a component that uses GridFS as a backend storage for files which can be consumed directly from our apps as Streams and even exposed to the OS using a volume mounter application.&lt;br/&gt;
When exposing to the OS, we implemented a locking scheme on top of GridFS to make our mounted drive as compliant as possible as any user level volume mounted in the OS. On that regard, we do offer liberal combinations of read/writes at the same time given the fact we can lock files on GridFS when using our higher level software layer on top of GridFS.&lt;/p&gt;

&lt;p&gt;I would argue that nothing is gained by completely restricting mixed read and writes because even if assume that files become readable once &quot;saved&quot; that will work as long as the header is written after all chunks are written, which by itself is not good strategy because you can easily leave orphan chunks on the database if the writer process crashes. &lt;br/&gt;
Without having a comprehensive locking scheme on GridFS, we should at least have a state field on the header to tell the state of the file. Could be something as simple a &quot;writing&quot; and &quot;ready&quot; or something along those lines. While &quot;writing&quot; you may prevent other GridFS clients from opening or even &quot;seeing&quot; the file existance, and also will give you a clean way to query for partially written files in case the writer process crashed before doing a clean save.&lt;/p&gt;

&lt;p&gt;Just adding that state field could allow to provide mixed read/write access in a way that writers will have to obtain exclusive access to write and Mongo support ways to atomically and concurrently modify an attribute that can be used to achieve this (simplistic locking scheme). Now, this might be a departure from current GridFS spec, but again, could be a MongoC enhancement to the spec.&lt;/p&gt;</comment>
                            <comment id="1040079" author="jesse" created="Tue, 22 Sep 2015 18:23:09 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=jsbattig%40convey.com&quot; class=&quot;user-hover&quot; rel=&quot;jsbattig@convey.com&quot;&gt;jsbattig@convey.com&lt;/a&gt; could you comment on whether you depend on saving a file to GridFS before reading it back, please? If we allow you to mix reads and writes on an unsaved file but not on a saved one, could you work within that restriction? Thanks.&lt;/p&gt;</comment>
                            <comment id="1040058" author="jesse" created="Tue, 22 Sep 2015 18:15:31 +0000"  >&lt;p&gt;The objection to allowing writes to a saved file is, another process can begin reading a file once it&apos;s saved. (Details: saving a file creates an entry for it in the db.fs.files collection, so another process, either the C driver or another client, could query it by name, get its files_id, and start reading chunks.)&lt;/p&gt;

&lt;p&gt;It is &lt;b&gt;sort&lt;/b&gt; of reasonable to allow a mix of reads and writes on an unsaved file, and it&apos;s too late to change our minds about that now. I hadn&apos;t realized we allowed writes to a saved file, I would really like to prohibit that.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="180462">CDRIVER-511</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <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|hsd9l3:</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="741">C Driver 2015Q2 sprint 8</customfieldvalue>

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