<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:52:51 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-688] Java driver concurrency documentation should state that db.requestStart() will not guarantee reading own writes with slaveOk if sharding</title>
                <link>https://jira.mongodb.org/browse/JAVA-688</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;The &lt;a href=&quot;http://www.mongodb.org/display/DOCS/Java+Driver+Concurrency&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Java Driver Concurrency&lt;/a&gt; documentation documents the use of &lt;tt&gt;db.requestStart()&lt;/tt&gt; and &lt;tt&gt;db.requestDone()&lt;/tt&gt; to try to ensure that you read your own write when slaveOk is set. However, it should indicate that this technique is only effective if you are not sharding, and hence the driver is connecting directly to the mongod instances. When you are sharding, while requests will be processed sequentially by the mongos, there is no guarantee that writes and reads will be directed to the same underlying mongod. Hence you should never use slaveOk in a sharded environment if consistency across requests is important.&lt;/p&gt;

&lt;p&gt;This documentation should also mention that slaveOk is deprecated, and instead (or also) refer to read preferences rather than slaveOk.&lt;/p&gt;

&lt;p&gt;Perhaps some of the other driver documentation has the same issues. I did not check.&lt;/p&gt;</description>
                <environment>&lt;a href=&quot;http://www.mongodb.org/display/DOCS/Java+Driver+Concurrency&quot;&gt;http://www.mongodb.org/display/DOCS/Java+Driver+Concurrency&lt;/a&gt;</environment>
        <key id="54976">JAVA-688</key>
            <summary>Java driver concurrency documentation should state that db.requestStart() will not guarantee reading own writes with slaveOk if sharding</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</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="2">Won&apos;t Fix</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="jantje.daniel">Ian Daniel</reporter>
                        <labels>
                    </labels>
                <created>Thu, 1 Nov 2012 06:00:18 +0000</created>
                <updated>Thu, 13 Nov 2014 22:58:17 +0000</updated>
                            <resolved>Thu, 13 Nov 2014 22:54:45 +0000</resolved>
                                                                    <component>Documentation</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="763932" author="jeff.yemin" created="Thu, 13 Nov 2014 22:58:17 +0000"  >&lt;p&gt;I also opened a pull request to remove reference to DB.requestStart from the concurrency page in the tutorial.&lt;/p&gt;</comment>
                            <comment id="763928" author="jeff.yemin" created="Thu, 13 Nov 2014 22:54:39 +0000"  >&lt;p&gt;These methods are deprecated in 2.13 and will be removed in 3.0.&lt;/p&gt;</comment>
                            <comment id="379819" author="jeff.yemin" created="Fri, 12 Jul 2013 14:34:12 +0000"  >&lt;p&gt;This can be more succinctly stated as DB.requestStart does not provide monotonicity.  Read preference is obeyed, even after a write.&lt;/p&gt;</comment>
                            <comment id="181849" author="scotthernandez" created="Fri, 2 Nov 2012 12:28:15 +0000"  >&lt;p&gt;This statement is true in general, &quot; you should never use slaveOk in a (sharded environment) if consistency across requests is important &quot;; you can remove the &quot;sharded environment&quot; part and it is still true. You need to ensure that the write is safe/w=all, and read only from the primary for this kind of consistency.&lt;/p&gt;</comment>
                            <comment id="181843" author="scotthernandez" created="Fri, 2 Nov 2012 12:25:08 +0000"  >&lt;p&gt;We can produce a simple test using the shell to prove this.&lt;/p&gt;

&lt;p&gt;If we start a replica set with 3 members (1 with a slaveDelay of 5 minutes to simulate noticeable replication lag) and put it behind mongos and set slaveOk then queries will go to the closest secondary (or split between them). If the only secondary left after shutting down the other one is the slaveDelay&apos;d node then queries will go to it, and all reads will be 5 minutes behind writes (at best), even if you use requestStart/End (since mongos deals with doling out requests).&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="168381">JAVA-1543</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                                        </inwardlinks>
                                    </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|hrga1j:</customfieldvalue>

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