<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:10: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>[CDRIVER-704] $readPreference sent to non-mongos</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-704</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;Revealed testing &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-679&quot; title=&quot;mongoc_client_kill_cursor triggers Server Selection&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-679&quot;&gt;&lt;del&gt;CDRIVER-679&lt;/del&gt;&lt;/a&gt;, the driver sends&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;   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;{ $query: { ... }, $readPreference: { mode: &quot;secondary&quot;, tags: [] } }&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;to a replica set secondary.&lt;/p&gt;

&lt;p&gt;Uncomment the query pattern in _test_kill_cursors to reproduce.&lt;/p&gt;

&lt;p&gt;To match Server Selection, the driver must send $readPreference only to mongos:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/specifications/blob/master/source/server-selection/server-selection.rst#passing-read-preference-to-mongos&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/specifications/blob/master/source/server-selection/server-selection.rst#passing-read-preference-to-mongos&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Verify the rest of $readPreference and slaveOkay-bit handling, too.&lt;/p&gt;</description>
                <environment></environment>
        <key id="210508">CDRIVER-704</key>
            <summary>$readPreference sent to non-mongos</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="jesse@mongodb.com">A. Jesse Jiryu Davis</assignee>
                                    <reporter username="jesse@mongodb.com">A. Jesse Jiryu Davis</reporter>
                        <labels>
                    </labels>
                <created>Sun, 14 Jun 2015 17:30:51 +0000</created>
                <updated>Wed, 19 Oct 2016 14:15:09 +0000</updated>
                            <resolved>Tue, 8 Sep 2015 22:41:46 +0000</resolved>
                                                    <fixVersion>1.2-rc0</fixVersion>
                                    <component>libmongoc</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="1131730" author="xgen-internal-githook" created="Mon, 11 Jan 2016 22:05:28 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;ajdavis&apos;, u&apos;name&apos;: u&apos;A. Jesse Jiryu Davis&apos;, u&apos;email&apos;: u&apos;jesse@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-704&quot; title=&quot;$readPreference sent to non-mongos&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-704&quot;&gt;&lt;del&gt;CDRIVER-704&lt;/del&gt;&lt;/a&gt; fix slaveOkay bit and $readPreference&lt;/p&gt;

&lt;p&gt;The driver sends $readPreference to mongods and mongoses, but it should&lt;br/&gt;
only send it to mongoses. Furthermore, it should not send&lt;br/&gt;
$readPreference to a mongos if the preference is secondaryPreferred.&lt;br/&gt;
Finally, it should set the SlaveOkay wire-protocol bit when&lt;br/&gt;
communicating with a standalone or replica set secondary.&lt;br/&gt;
Branch: 1.3.0-dev&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/abeca13630c52459717ab4cbfa181c7769c1aa80&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/abeca13630c52459717ab4cbfa181c7769c1aa80&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1070866" author="xgen-internal-githook" created="Mon, 26 Oct 2015 20:33:54 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;ajdavis&apos;, u&apos;name&apos;: u&apos;A. Jesse Jiryu Davis&apos;, u&apos;email&apos;: u&apos;jesse@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-704&quot; title=&quot;$readPreference sent to non-mongos&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-704&quot;&gt;&lt;del&gt;CDRIVER-704&lt;/del&gt;&lt;/a&gt; fix slaveOkay bit and $readPreference&lt;/p&gt;

&lt;p&gt;The driver sends $readPreference to mongods and mongoses, but it should&lt;br/&gt;
only send it to mongoses. Furthermore, it should not send&lt;br/&gt;
$readPreference to a mongos if the preference is secondaryPreferred.&lt;br/&gt;
Finally, it should set the SlaveOkay wire-protocol bit when&lt;br/&gt;
communicating with a standalone or replica set secondary.&lt;br/&gt;
Branch: debian&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/abeca13630c52459717ab4cbfa181c7769c1aa80&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/abeca13630c52459717ab4cbfa181c7769c1aa80&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1051773" author="xgen-internal-githook" created="Mon, 5 Oct 2015 21:25:41 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;jmikola&apos;, u&apos;name&apos;: u&apos;Jeremy Mikola&apos;, u&apos;email&apos;: u&apos;jmikola@gmail.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/PHPC-409&quot; title=&quot;mongoc 1.2.0-rc0[-dev] changes&quot; class=&quot;issue-link&quot; data-issue-key=&quot;PHPC-409&quot;&gt;&lt;del&gt;PHPC-409&lt;/del&gt;&lt;/a&gt;: $readPreference is no longer sent to non-mongos nodes&lt;/p&gt;

&lt;p&gt;Fixed by &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-704&quot; title=&quot;$readPreference sent to non-mongos&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-704&quot;&gt;&lt;del&gt;CDRIVER-704&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb-labs/mongo-php-driver-prototype/commit/51a9ad7ef4b2a57489f5d9f9e26bbc3100835450&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb-labs/mongo-php-driver-prototype/commit/51a9ad7ef4b2a57489f5d9f9e26bbc3100835450&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1024621" author="xgen-internal-githook" created="Tue, 8 Sep 2015 22:41:28 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;ajdavis&apos;, u&apos;name&apos;: u&apos;A. Jesse Jiryu Davis&apos;, u&apos;email&apos;: u&apos;jesse@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-704&quot; title=&quot;$readPreference sent to non-mongos&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-704&quot;&gt;&lt;del&gt;CDRIVER-704&lt;/del&gt;&lt;/a&gt; fix slaveOkay bit and $readPreference&lt;/p&gt;

&lt;p&gt;The driver sends $readPreference to mongods and mongoses, but it should&lt;br/&gt;
only send it to mongoses. Furthermore, it should not send&lt;br/&gt;
$readPreference to a mongos if the preference is secondaryPreferred.&lt;br/&gt;
Finally, it should set the SlaveOkay wire-protocol bit when&lt;br/&gt;
communicating with a standalone or replica set secondary.&lt;br/&gt;
Branch: 1.2.0-dev&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/abeca13630c52459717ab4cbfa181c7769c1aa80&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/abeca13630c52459717ab4cbfa181c7769c1aa80&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1002229" author="bjori" created="Tue, 11 Aug 2015 17:47:15 +0000"  >&lt;p&gt;It appears we are also sending $readPreference to a primary when a command is re-routed to a primary while readpreference would otherwise direct the command elsewhere:&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;   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;{ ping: 1, $readPreference: { mode: &quot;secondaryPreferred&quot;, tags: [] } }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;</comment>
                            <comment id="967413" author="jesse" created="Thu, 16 Jul 2015 01:06:13 +0000"  >&lt;p&gt;It seems like the driver does &lt;b&gt;not&lt;/b&gt; set SlaveOkay. These two wrongs make a right, when combined with a bizarre quirk in mongod. A secondary considers a query like this:&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;   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;{$query: {...}, $readPreference: &amp;lt;anything&amp;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;... to be the same as a query with the SlaveOkay bit set.&lt;/p&gt;

&lt;p&gt;mongos has had special handling of $readPreference since version 2.2 (&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-4464&quot; title=&quot;drivers and mongos should support 5 read preferences&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-4464&quot;&gt;&lt;del&gt;SERVER-4464&lt;/del&gt;&lt;/a&gt;). As a side effect of that implementation, a mongod 2.2 secondary considers any query of the above form to be the same as a query with SlaveOkay. This is completely independent of sharding.&lt;/p&gt;

&lt;p&gt;It doesn&apos;t matter what the $readPreference contains:&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;rs-22:SECONDARY&amp;gt; db.test.findOne()&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;Error: { &quot;$err&quot; : &quot;not master and slaveOk=false&quot;, &quot;code&quot; : 13435 }&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;rs-22:SECONDARY&amp;gt; db.test.findOne({$query: {}, $readPreference: {mode: &apos;primary&apos;}})&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;{ &quot;_id&quot; : 1 }&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;rs-22:SECONDARY&amp;gt; db.test.findOne({$query: {}, $readPreference: &quot;rabbit&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;   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;{ &quot;_id&quot; : 1 }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="228512">CDRIVER-829</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="93023">CDRIVER-240</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="229022">PHPC-409</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|hreavj:</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="676">C Driver 2015Q2 sprint 6</customfieldvalue>
    <customfieldvalue id="699">C Driver 2015Q2 sprint 7</customfieldvalue>

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