<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:40: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>[CSHARP-1682] Race condition could result in GridFS indexes not being created</title>
                <link>https://jira.mongodb.org/browse/CSHARP-1682</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;h1&gt;&lt;a name=&quot;OriginalDescription&quot;&gt;&lt;/a&gt;Original Description&lt;/h1&gt;

&lt;blockquote&gt;&lt;p&gt;The original description is unchanged below. See additional information below under Diagnosis.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;We use the C# GridFS Package 2.2.3/2.2.4 against a Replica Set running MongoDB 3.2.6 and WiredTiger.&lt;/p&gt;

&lt;p&gt;We&apos;re facing the following Problem:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;Open a Stream using OpenDownloadStreamByNameAsync with a CancellationToken results in hanging the Application&lt;/li&gt;
	&lt;li&gt;Our GridFS do have about about 500K to xxxxK Chunks&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;After comparing various Installation of our Application on differnet Platforms (DEV, INT, STAGING, PROD),&lt;br/&gt;
we noticed, that the Index files_id_1_n_1 in .chunks collection and filename_1_uploadDate_1 in .files is missing.&lt;br/&gt;
We also reference to this Article: &lt;a href=&quot;https://www.mongodb.com/blog/post/building-mongodb-applications-binary-files-using-gridfs-part-2&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://www.mongodb.com/blog/post/building-mongodb-applications-binary-files-using-gridfs-part-2&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the event on creating the &quot;files_id_1_n_1 &quot; index on the .chunks collection manually, the platform worked as expected.&lt;/p&gt;

&lt;p&gt;After analysing the C# Driver code on GitHub, we understood that the indecies are created by the driver (and not the server).&lt;/p&gt;

&lt;p&gt;Under which conditions, this index is created / or not created?&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;could it be, that if the cancellation token is set to a small timeout (e.g 5 Seconds), the index is never created (because it takes longer to build - and get cancelled)?&lt;/li&gt;
	&lt;li&gt;is the index needed by the driver - and blocks internally if not there?&lt;/li&gt;
	&lt;li&gt;is it safe to create the index manually?&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;This issue is really urgent to us because it affects our caching-strategy and the recreation of those indexes on our production environment takes to much time. When we recreate that index  the mongoDb takes all tickets available which makes our application &lt;b&gt;unusable&lt;/b&gt; ! We can&apos;t even connect to the primary though the shell or mongochef.&lt;/p&gt;

&lt;p&gt;Best regards,&lt;br/&gt;
Alessandro Catale&lt;br/&gt;
__________________________________________________________&lt;br/&gt;
ICT Application Operation Manager&lt;/p&gt;

&lt;p&gt;Office	+41 58 221 48 55&lt;br/&gt;
Mobile	+41 79 271 04 12&lt;br/&gt;
alessandro.catale@swisscom.com&lt;br/&gt;
__________________________________________________________&lt;br/&gt;
Swisscom IT Services AG&lt;br/&gt;
Outsourcing Services&lt;br/&gt;
Pfingstweidstrasse 51&lt;br/&gt;
8005 Z&#252;rich&lt;br/&gt;
www.swisscom.ch/it-services&lt;/p&gt;

&lt;p&gt;Swisscom IT Services&lt;br/&gt;
Outsourcing | Workplace | SAP | Finance&lt;/p&gt;

&lt;h1&gt;&lt;a name=&quot;Diagnosis&quot;&gt;&lt;/a&gt;Diagnosis&lt;/h1&gt;

&lt;p&gt;There is a race condition in the EnsureIndexes method: &lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/blob/0ad339c4c889076680245c3786bddf3ddd2654e3/src/MongoDB.Driver.GridFS/GridFSBucket.cs#L768&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/blob/0ad339c4c889076680245c3786bddf3ddd2654e3/src/MongoDB.Driver.GridFS/GridFSBucket.cs#L768&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If two threads attempt to upload a file at the same time it is possible that the first thread will acquire the __ensuredIndexes lock on line 770 and then see a non-empty collection on line 773 because the second thread might have uploaded a different file in the meantime.&lt;/p&gt;

</description>
                <environment></environment>
        <key id="290740">CSHARP-1682</key>
            <summary>Race condition could result in GridFS indexes not being created</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="2" iconUrl="https://jira.mongodb.org/images/icons/priorities/critical.svg">Critical - P2</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="robert@mongodb.com">Robert Stam</assignee>
                                    <reporter username="alessandro.catale@swisscom.com">Alessandro Catale</reporter>
                        <labels>
                    </labels>
                <created>Wed, 1 Jun 2016 16:13:18 +0000</created>
                <updated>Fri, 23 Sep 2016 19:50:35 +0000</updated>
                            <resolved>Tue, 7 Jun 2016 20:33:11 +0000</resolved>
                                    <version>2.2.4</version>
                                    <fixVersion>2.3</fixVersion>
                                    <component>GridFS</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="1287062" author="xgen-internal-githook" created="Tue, 7 Jun 2016 20:32:35 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;rstam&apos;, u&apos;name&apos;: u&apos;rstam&apos;, u&apos;email&apos;: u&apos;robert@robertstam.org&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-1682&quot; title=&quot;Race condition could result in GridFS indexes not being created&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-1682&quot;&gt;&lt;del&gt;CSHARP-1682&lt;/del&gt;&lt;/a&gt;: Fix race condition in GridFS EnsureIndexes.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/08e449d57699ff937169ee0d726d757fcadd8e21&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/08e449d57699ff937169ee0d726d757fcadd8e21&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1281903" author="rstam" created="Wed, 1 Jun 2016 23:39:41 +0000"  >&lt;p&gt;I think another workaround would be for each thread to create its own instance of GridFSBucket. That would also eliminate the race condition because each bucket would only have one thread using it.&lt;/p&gt;

&lt;p&gt;Creating an instance of GridFSBucket is fairly cheap. So this workaround would not be expensive. It would result in each thread probing the files collection to see if it is empty, but that&apos;s exactly what the other workaround I suggested does.&lt;/p&gt;</comment>
                            <comment id="1281834" author="alessandro.catale@swisscom.com" created="Wed, 1 Jun 2016 22:26:23 +0000"  >&lt;p&gt;Thanks! We&apos;ll test it asap and I&apos;ll give you feedback asap!&lt;/p&gt;</comment>
                            <comment id="1281825" author="rstam" created="Wed, 1 Jun 2016 22:19:13 +0000"  >&lt;p&gt;I don&apos;t have a workaround for re-creating the missing indexes.&lt;/p&gt;

&lt;p&gt;They have to be created for GridFS to work. Your only options are to create them in the foreground or the background.&lt;/p&gt;</comment>
                            <comment id="1281824" author="rstam" created="Wed, 1 Jun 2016 22:18:27 +0000"  >&lt;p&gt;Here&apos;s a workaround that would prevent the issue from occurring again with the current driver. Since the problem is that there is a race condition that &lt;b&gt;could&lt;/b&gt; result in the indexes not being created, just call this helper method first before uploading a file:&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;public static void EnsureGridFSIndexes(IGridFSBucket bucket)&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;{&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;    var filesCollectionName = $&quot;{bucket.Options.BucketName}.files&quot;;&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;    var filesCollection = bucket.Database.GetCollection&amp;lt;BsonDocument&amp;gt;(filesCollectionName);&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;    var firstFileId = filesCollection.Find(new BsonDocument()).Limit(1).Project(new BsonDocument(&quot;_id&quot;, 1)).FirstOrDefault();&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 (firstFileId == null)&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;    {&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;        var chunksCollectionName = $&quot;{bucket.Options.BucketName}.chunks&quot;;&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;        var chunksCollection = bucket.Database.GetCollection&amp;lt;BsonDocument&amp;gt;(chunksCollectionName);&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;&amp;nbsp;&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;        filesCollection.Indexes.CreateOne(&quot;{ filename : 1, uploadDate : 1 }&quot;);&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;        chunksCollection.Indexes.CreateOne(&quot;{ files_id : 1, n : 1 }&quot;, new CreateIndexOptions { Unique = true });&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;    }&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;This will do a quick round trip to the server to probe whether the files collection is empty or not, and if it is it will create the indexes. It doesn&apos;t matter if multiple threads happen to see an empty collection at the same time. The server knows how to handle multiple simultaneous create index requests for the same index and will only create the index once.&lt;/p&gt;</comment>
                            <comment id="1281815" author="alessandro.catale@swisscom.com" created="Wed, 1 Jun 2016 22:12:15 +0000"  >&lt;p&gt;Ok, would you like to skype tommorrow? I&apos;ll arrange that our developpers would be also available.&lt;/p&gt;

&lt;p&gt;Would your workaround be creating the index on a secondary? That&apos;s not a solution for us and it will still take too much time. &lt;/p&gt;

&lt;p&gt;We also couldn&apos;t resync the node (we took him offline in order to be able to drop these cache-collections) last time. We opened up also a ticket: &lt;a href=&quot;https://jira.mongodb.org/browse/CS-31114&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/CS-31114&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1281801" author="rstam" created="Wed, 1 Jun 2016 21:58:46 +0000"  >&lt;p&gt;We don&apos;t have a release planned yet for the near future.&lt;/p&gt;

&lt;p&gt;I can help you come up with a workaround. That would solve your problem in the short term. And be much faster than waiting for the next release.&lt;/p&gt;</comment>
                            <comment id="1281789" author="alessandro.catale@swisscom.com" created="Wed, 1 Jun 2016 21:51:49 +0000"  >&lt;p&gt;Thank you very much! I tested it and got the same results.&lt;/p&gt;

&lt;p&gt;It&apos;s really urgent because a recreate of the chunks-index causes nearly a crash in our production cacheDb. It seems like mongoDB takes all tickets available only for the recreate! We have 3&apos;500&apos;000 items and we&apos;re just at the beginning...&lt;/p&gt;

&lt;p&gt;When can we expect a solution for this issue? &lt;/p&gt;</comment>
                            <comment id="1281787" author="rstam" created="Wed, 1 Jun 2016 21:44:55 +0000"  >&lt;p&gt;I would like to add that there is no safe way to drop the GridFS collections while an application that uses them is running.&lt;/p&gt;

&lt;p&gt;The issue is that no matter which collection you drop first there could be consistency problems between the two. There is no command to the server to drop two collections atomically.&lt;/p&gt;

&lt;p&gt;There may be an upload or download in progress when you drop the collections, and that will result in either errors or a corrupted upload.&lt;/p&gt;</comment>
                            <comment id="1281580" author="rstam" created="Wed, 1 Jun 2016 19:32:58 +0000"  >&lt;p&gt;Yes, that sounds plausible. If the GridFS collections are dropped while the application is running the application won&apos;t notice and won&apos;t re-create the indexes. And restarting the application when the collections are no longer empty also won&apos;t re-create the indexes.&lt;/p&gt;

&lt;p&gt;And it also looks like the race condition in EnsureIndexes could result in the indexes not getting created in the first place. We&apos;ll fix that.&lt;/p&gt;</comment>
                            <comment id="1281307" author="alessandro.catale@swisscom.com" created="Wed, 1 Jun 2016 17:13:38 +0000"  >
&lt;p&gt;in a very first try, we can confirm this:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;we stopped all the applications, dropped the collection, started them =&amp;gt; index was there.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;so we though about how this could have been happen:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;maybe one dropped the grid fs collections&lt;/li&gt;
	&lt;li&gt;files got inserted by normal operations&lt;/li&gt;
	&lt;li&gt;gridfs got super slow (after some time)&lt;/li&gt;
	&lt;li&gt;a restart of the application has then not created the indexes (because maybe not empty / too many documents)&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;could you think this is the case?&lt;/p&gt;
</comment>
                            <comment id="1281295" author="rstam" created="Wed, 1 Jun 2016 16:56:43 +0000"  >&lt;p&gt;If you dropped the collections without restarting the applications the indexes would not have been re-created. Each process only checks once whether the indexes need to be created. It doesn&apos;t check repeatedly.&lt;/p&gt;

&lt;p&gt;And yes, GridFS would work without the indexes but would be doing full collection scans, so as soon as the collections got big enough the GridFS operations would slow significantly.&lt;/p&gt;</comment>
                            <comment id="1281282" author="alessandro.catale@swisscom.com" created="Wed, 1 Jun 2016 16:48:21 +0000"  >&lt;p&gt;We also dropped the collection and the indexes have not been created. We also found out that is runs without indexes but after a certain time it&apos;s unusable.&lt;/p&gt;</comment>
                            <comment id="1281276" author="alessandro.catale@swisscom.com" created="Wed, 1 Jun 2016 16:43:58 +0000"  >&lt;p&gt;Thank you Robert for your super fast answer!&lt;/p&gt;

&lt;p&gt;We set up a new environment with an empty replicase, the latest stable driver and db and noticed the same problem: the driver has created the collections, but on uploading the first files, the gridfs specific index were not created.&lt;/p&gt;

&lt;p&gt;We then retested the same procedure with a local installation (no replicaset, no authentisation etc. etc.) - and the index got created. It kind of smeels like your idea of the problem.&lt;/p&gt;

&lt;p&gt;We use GridFS as a caching storage for pictures &amp;amp; videos. The possibility of hitting the db fast is highly.&lt;/p&gt;
</comment>
                            <comment id="1281257" author="rstam" created="Wed, 1 Jun 2016 16:33:18 +0000"  >&lt;p&gt;The indexes needed by GridFS are created when the very first file is uploaded to GridFS and the collection is empty.&lt;/p&gt;

&lt;p&gt;The GridFS code itself never deletes these indexes. But if these indexes are ever deleted, they will not magically come back. They will have to be manually recreated (which as you have noted is resource intensive if the GridFS collections are large).&lt;/p&gt;

&lt;p&gt;Looking at the GridFS code it looks like there might be a race condition if multiple threads simultaneously attempt to upload the very first GridFS file. But if you&apos;ve already uploaded thousands of GridFS files this did probably not affect you.&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|hrd03j:</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="1107">C# Sprint 37</customfieldvalue>

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