<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:51:33 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-120] Driver not catching &quot;not master&quot; error when running with replica pairs</title>
                <link>https://jira.mongodb.org/browse/JAVA-120</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;I&apos;ve been trying to an application against a replica pair of mongodb 1.4.3 servers with driver version 2.0 (also occurs on 1.4).  I&apos;ve noticed an issue when servers switch master/slave roles that the driver is not transitioning and instead the error message filters up through the application.  Here is a sample stack trace:&lt;/p&gt;

&lt;p&gt;com.mongodb.MongoException: error counting : &lt;/p&gt;
{ &quot;&quot; : &quot;not master&quot; , &quot;ok&quot; : 0.0}
&lt;p&gt;	at com.mongodb.DBCollection.getCount(DBCollection.java:524)&lt;br/&gt;
	at com.mongodb.DBCollection.getCount(DBCollection.java:492)&lt;/p&gt;

&lt;p&gt;This error will occur if the master of the pair is taken down then brought back up without the application being aware of it.  At that point, the current server in the driver would be pointing to the slave server.  So, the next request from the driver would get &quot;not master&quot; error.&lt;/p&gt;

&lt;p&gt;After some investigation, I noticed that the problem appears to be in the way the error is caught.  The driver expects errors to be in the format &lt;/p&gt;
{ &quot;$err&quot; : &quot;.....&quot; }
&lt;p&gt;, however, in this case what I am seeing is  &lt;/p&gt;
{ &quot;errmsg&quot; : &quot;not master&quot; }
&lt;p&gt; which doesn&apos;t get caught by Response.java as an error (so all the logic that is supposed to take place does not get triggered).&lt;/p&gt;

&lt;p&gt;I&apos;ve locally made changes to also take &quot;errmsg&quot; as a valid error and then the switch between master/slave works.  I&apos;ve attached the two modified files for driver 2.0.  I&apos;m not certain why this error isn&apos;t coming up as &quot;$err&quot; - which would seem reasonable.&lt;/p&gt;</description>
                <environment>mongodb server 1.4.3 - driver 2.0</environment>
        <key id="12159">JAVA-120</key>
            <summary>Driver not catching &quot;not master&quot; error when running with replica pairs</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="eliot">Eliot Horowitz</assignee>
                                    <reporter username="rloghin">Razvan Loghin</reporter>
                        <labels>
                    </labels>
                <created>Tue, 15 Jun 2010 12:32:12 +0000</created>
                <updated>Fri, 29 Oct 2010 02:49:58 +0000</updated>
                            <resolved>Wed, 18 Aug 2010 19:28:07 +0000</resolved>
                                    <version>1.4</version>
                    <version>2.0</version>
                                    <fixVersion>2.1</fixVersion>
                                                        <votes>1</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="17017" author="auto" created="Wed, 18 Aug 2010 19:28:11 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;login&apos;: &apos;erh&apos;, &apos;name&apos;: &apos;Eliot Horowitz&apos;, &apos;email&apos;: &apos;eliot@10gen.com&apos;}
&lt;p&gt;Message: fix catching of &quot;not master&quot; and error cleaning &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-120&quot; title=&quot;Driver not catching &amp;quot;not master&amp;quot; error when running with replica pairs&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-120&quot;&gt;&lt;del&gt;JAVA-120&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;http://github.com/mongodb/mongo-java-driver/commit/146f67510f123e0b984627fb7d667e1be4195dbb&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://github.com/mongodb/mongo-java-driver/commit/146f67510f123e0b984627fb7d667e1be4195dbb&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="16662" author="mousehouse" created="Tue, 10 Aug 2010 05:46:16 +0000"  >&lt;p&gt;I was troubled with the same problem in java driver 2.0 when i use replica set (1.6.0).&lt;/p&gt;

&lt;p&gt;I insert 1000 object into a collection. After we  finished 500 objects , there is a switch between primary and secondary (replica set), and the pending objects are lost.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="10240" name="Response.java" size="5091" author="rloghin" created="Tue, 15 Jun 2010 12:32:12 +0000"/>
                            <attachment id="10241" name="ServerError.java" size="1237" author="rloghin" created="Tue, 15 Jun 2010 12:32:12 +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|hrhd4n:</customfieldvalue>

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