<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:52:23 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-477] Read from primary server in replica set fails when using TaggedReadPreference</title>
                <link>https://jira.mongodb.org/browse/JAVA-477</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;I&apos;m trying to use the TaggedReadPreference with the Java driver when &lt;br/&gt;
reading from a replica set.  It seems to work as long as I specify a &lt;br/&gt;
secondary tag.  When I specify the primary tag, I get the following &lt;br/&gt;
exception: &lt;/p&gt;

&lt;p&gt;com.mongodb.MongoException: Could not find any valid secondaries with &lt;br/&gt;
the supplied tags (&apos;&lt;/p&gt;
{ &quot;locale&quot; : &quot;sc&quot;}
&lt;p&gt;&apos; &lt;br/&gt;
        at com.mongodb.DBTCPConnector$MyPort.get(DBTCPConnector.java:358) &lt;br/&gt;
        at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:212) &lt;br/&gt;
        at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:305) &lt;br/&gt;
        at com.mongodb.DBCollection.findOne(DBCollection.java:647) &lt;br/&gt;
        at com.mongodb.DBCollection.findOne(DBCollection.java:626) &lt;/p&gt;

&lt;p&gt;I also tested reading from the secondary and killing the primary.  When&lt;br/&gt;
the secondary is elected the primary, the read fails with the same&lt;br/&gt;
exception above (just with a different locale).&lt;/p&gt;

&lt;p&gt;My code looks like: &lt;/p&gt;

&lt;p&gt;HashMap&amp;lt;String, String&amp;gt; tags = new HashMap&amp;lt;String, String&amp;gt;(1); &lt;br/&gt;
tags.put(&quot;locale&quot;, &quot;sc&quot;); &lt;br/&gt;
... &lt;br/&gt;
dbCollection.setReadPreference(new &lt;br/&gt;
ReadPreference.TaggedReadPreference(tags)); &lt;/p&gt;

&lt;p&gt;My replica set is configured as: &lt;/p&gt;

&lt;p&gt;PRIMARY&amp;gt; rs.conf() &lt;br/&gt;
{ &lt;br/&gt;
        &quot;_id&quot; : &quot;test&quot;, &lt;br/&gt;
        &quot;version&quot; : 3, &lt;br/&gt;
        &quot;members&quot; : [ &lt;br/&gt;
                { &lt;br/&gt;
                        &quot;_id&quot; : 0, &lt;br/&gt;
                        &quot;host&quot; : &quot;localhost:27020&quot;, &lt;br/&gt;
                        &quot;priority&quot; : 2, &lt;br/&gt;
                        &quot;tags&quot; : &lt;/p&gt;
{ 
                                &quot;locale&quot; : &quot;sc&quot; 
                        }
&lt;p&gt; &lt;br/&gt;
                }, &lt;br/&gt;
                { &lt;br/&gt;
                        &quot;_id&quot; : 1, &lt;br/&gt;
                        &quot;host&quot; : &quot;localhost:27021&quot;, &lt;br/&gt;
                        &quot;tags&quot; : &lt;/p&gt;
{ 
                                &quot;locale&quot; : &quot;in&quot; 
                        }
&lt;p&gt; &lt;br/&gt;
                }, &lt;br/&gt;
                { &lt;br/&gt;
                        &quot;_id&quot; : 2, &lt;br/&gt;
                        &quot;host&quot; : &quot;localhost:27022&quot;, &lt;br/&gt;
                        &quot;tags&quot; : &lt;/p&gt;
{ 
                                &quot;locale&quot; : &quot;de&quot; 
                        }
&lt;p&gt; &lt;br/&gt;
                } &lt;br/&gt;
        ] &lt;/p&gt;</description>
                <environment>All components running on OS X 10.7.2.  MongoDB version 2.0.1.  Java driver version 2.7.2.  </environment>
        <key id="25541">JAVA-477</key>
            <summary>Read from primary server in replica set fails when using TaggedReadPreference</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="brendan">Brendan W. McAdams</assignee>
                                    <reporter username="bhunt">Bryan Hunt</reporter>
                        <labels>
                    </labels>
                <created>Sun, 27 Nov 2011 05:04:02 +0000</created>
                <updated>Sun, 12 Aug 2012 03:25:06 +0000</updated>
                            <resolved>Sun, 12 Aug 2012 03:23:09 +0000</resolved>
                                    <version>2.7.2</version>
                                                    <component>Cluster Management</component>
                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="152585" author="jeff.yemin" created="Sun, 12 Aug 2012 03:25:06 +0000"  >&lt;p&gt;this will be fixed in 2.9.0&lt;/p&gt;</comment>
                            <comment id="73139" author="brendan" created="Wed, 14 Dec 2011 19:49:40 +0000"  >&lt;p&gt;Fix depends on next major release of MongoDB which supports Tagged Read Preferencing in mongos.&lt;/p&gt;</comment>
                            <comment id="69228" author="scotthernandez" created="Mon, 28 Nov 2011 14:54:55 +0000"  >&lt;p&gt;It is currently enabled in master in github so if you build from source you can test it.&lt;/p&gt;

&lt;p&gt;As Eliot said, it will not be in 2.7.x&lt;/p&gt;</comment>
                            <comment id="69224" author="eliot" created="Mon, 28 Nov 2011 14:51:34 +0000"  >&lt;p&gt;Its supposed to be in 2.8 (or whatever the next version of the driver is called).&lt;br/&gt;
Not sure if its status in the code there.&lt;/p&gt;</comment>
                            <comment id="69214" author="bhunt" created="Mon, 28 Nov 2011 13:58:52 +0000"  >&lt;p&gt;Doh!  I was hoping to use this feature to help make my case for MongoDB with management.  My use case is probably typical in that we need to deploy servers in multiple countries.  Write propagation is not critical, but local reads are.&lt;/p&gt;

&lt;p&gt;Any chance you would consider fixing the non-sharding case in 2.7.3 and then remove the feature in 2.7.4 so I could at least try a demo for my management?&lt;/p&gt;

&lt;p&gt;Any ETA on when this feature will be fully released?&lt;/p&gt;</comment>
                            <comment id="69187" author="brendan" created="Mon, 28 Nov 2011 09:41:21 +0000"  >&lt;p&gt;Inner Static class for Tagged Read Preference should be disabled to prevent user access to this not-yet-enabled feature.&lt;/p&gt;</comment>
                            <comment id="69185" author="brendan" created="Mon, 28 Nov 2011 09:39:20 +0000"  >&lt;p&gt;Reading by tags is not currently supported and should have been disabled in the driver; it seems that the class stub for future support was left exposed  in this release and shouldn&apos;t have been.&lt;/p&gt;

&lt;p&gt;Until mongos supports reading by tags we are not adding support for that to our drivers to provide consistent support of features across sharded and unsharded setups.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="25162">JAVA-474</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </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|hrhbi7:</customfieldvalue>

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