<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:52:12 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-401] &quot;not master&quot; MongoException when using GridFS with a direction connection to a secondary</title>
                <link>https://jira.mongodb.org/browse/JAVA-401</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;I got an Exception &quot;not master&quot; when i read from the secondary.&lt;br/&gt;
In the GridFS structure method, when the files collections count less&lt;br/&gt;
then 1000, mongodb will to ensure standard indexes. but secondary is&lt;br/&gt;
not allow write operations.&lt;br/&gt;
so, how do i read files from a secondary?&lt;/p&gt;</description>
                <environment>linux 64, replica set.</environment>
        <key id="20128">JAVA-401</key>
            <summary>&quot;not master&quot; MongoException when using GridFS with a direction connection to a secondary</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</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="machengp">go</reporter>
                        <labels>
                    </labels>
                <created>Tue, 26 Jul 2011 09:30:53 +0000</created>
                <updated>Sat, 17 Aug 2013 00:05:45 +0000</updated>
                            <resolved>Tue, 18 Jun 2013 01:50:31 +0000</resolved>
                                    <version>2.6.3</version>
                                    <fixVersion>2.11.2</fixVersion>
                    <fixVersion>2.12.0</fixVersion>
                                    <component>GridFS</component>
                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="362316" author="auto" created="Tue, 18 Jun 2013 01:46:58 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;jyemin&apos;, u&apos;name&apos;: u&apos;Jeff Yemin&apos;, u&apos;email&apos;: u&apos;jeff.yemin@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-401&quot; title=&quot;&amp;quot;not master&amp;quot; MongoException when using GridFS with a direction connection to a secondary&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-401&quot;&gt;&lt;del&gt;JAVA-401&lt;/del&gt;&lt;/a&gt;: Catch and log exception on ensuring indices for GridFS collections.  Exceptions can happen if the MongoClient is a direct connection to a secondary, so this can happen under normal circumstances.&lt;br/&gt;
Branch: 2.11.x&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/7d0c537188d86a27b21e658eecd40232b5b18ea8&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/7d0c537188d86a27b21e658eecd40232b5b18ea8&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="362313" author="auto" created="Tue, 18 Jun 2013 01:44:41 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;jyemin&apos;, u&apos;name&apos;: u&apos;Jeff Yemin&apos;, u&apos;email&apos;: u&apos;jeff.yemin@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-401&quot; title=&quot;&amp;quot;not master&amp;quot; MongoException when using GridFS with a direction connection to a secondary&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-401&quot;&gt;&lt;del&gt;JAVA-401&lt;/del&gt;&lt;/a&gt;: Catch and log exception on ensuring indices for GridFS collections.  Exceptions can happen if the MongoClient is a direct connection to a secondary, so this can happen under normal circumstances.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/595b30b45c31771f46a7fbfb8ff519e4820560e3&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/595b30b45c31771f46a7fbfb8ff519e4820560e3&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="236372" author="scotthernandez" created="Thu, 10 Jan 2013 18:28:17 +0000"  >&lt;p&gt;Yes, or verify the connection is to a primary/master here: &lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/blob/master/src/main/com/mongodb/gridfs/GridFS.java#L93&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/blob/master/src/main/com/mongodb/gridfs/GridFS.java#L93&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="114526" author="jeff.yemin" created="Sat, 28 Apr 2012 01:23:44 +0000"  >&lt;p&gt;The workaround for this is to provide a seed list instead of a single server, so that a replica set connection is established.  Then call DB.slaveOk() on the gridfs database to ensure reads from secondaries.&lt;/p&gt;

&lt;p&gt;To fix this, the most straightforward thing to do is to surround the calls to ensureIndex with a try-catch of MongoException, since a failure to create the index is not a failure condition.&lt;/p&gt;</comment>
                            <comment id="46965" author="dan@10gen.com" created="Mon, 8 Aug 2011 06:38:25 +0000"  >&lt;p&gt;This comes from thread in mongo-user: &lt;a href=&quot;http://groups.google.com/group/mongodb-user/browse_thread/thread/ec4df92c7c4d1857&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://groups.google.com/group/mongodb-user/browse_thread/thread/ec4df92c7c4d1857&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="69403">JAVA-790</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="12560" name="mongo.log" size="7549020" author="machengp" created="Mon, 8 Aug 2011 07:39:46 +0000"/>
                    </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|hrhbuv:</customfieldvalue>

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