<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:32:07 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>[SERVER-13562] Queries that use tailable cursors do not stream results if skip() is applied</title>
                <link>https://jira.mongodb.org/browse/SERVER-13562</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;div class=&quot;panel&quot; style=&quot;background-color: #EEEEEE;border-color: #ccc;border-width: 1px;&quot;&gt;&lt;div class=&quot;panelHeader&quot; style=&quot;border-bottom-width: 1px;border-bottom-color: #ccc;background-color: #6CB33F;&quot;&gt;&lt;b&gt;Issue Status as of April 15, 2014&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;panelContent&quot; style=&quot;background-color: #EEEEEE;&quot;&gt;
&lt;p&gt;&lt;b&gt;ISSUE SUMMARY&lt;/b&gt;&lt;br/&gt;
Queries that use tailable cursors do not stream results if &lt;tt&gt;.skip()&lt;/tt&gt; or negative values for &lt;tt&gt;.limit()&lt;/tt&gt; are applied but instead close the cursor after returning the first batch.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;USER IMPACT&lt;/b&gt;&lt;br/&gt;
Internal operations (replication etc.) are not affected but user-issued queries using tailable cursors may return incomplete results.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;WORKAROUNDS&lt;/b&gt;&lt;br/&gt;
Try avoiding &lt;tt&gt;.skip()&lt;/tt&gt; with tailable cursors and use other query predicates (e.g. &lt;tt&gt;$gt&lt;/tt&gt;) if possible.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;RESOLUTION&lt;/b&gt;&lt;br/&gt;
Tailable cursors now correctly continue to return batches via the &lt;tt&gt;getmore&lt;/tt&gt; command when combined with &lt;tt&gt;.skip()&lt;/tt&gt; or negative values of &lt;tt&gt;.limit()&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;AFFECTED VERSIONS&lt;/b&gt;&lt;br/&gt;
Version 2.6.0 is affected by this bug.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;PATCHES&lt;/b&gt;&lt;br/&gt;
The patch is included in the 2.6.1 production release.&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;h6&gt;&lt;a name=&quot;Originaldescription&quot;&gt;&lt;/a&gt;Original description&lt;/h6&gt;

&lt;p&gt;Queries that use tailable cursors do not stream results if skip() is applied. &lt;/p&gt;

&lt;p&gt;e.g.&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;db.foo.find().addOption(34).skip(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;

&lt;p&gt;Original description:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;A capped collection created by an older version of the server can no longer be &apos;tracked&apos; by a tailable cursor in 2.6.0; there was no issue with these collections using tailable cursors in v2.4.9.  The capped collection being used was probably created pre-v2.2, but I&apos;m not sure and can&apos;t find a way to determine.  This collection did not have an index on &apos;_id&apos;, which was added prior to the v2.6.0. upgrade.&lt;/p&gt;

&lt;p&gt;This is not an issue if the capped collection is created with v2.6.0.&lt;/p&gt;

&lt;p&gt;Steps to Reproduce:&lt;/p&gt;

&lt;p&gt;Using a capped collection created in an older version of the server, e.g. &apos;test.cap1&apos;, attempt to track the inserts to this collection using two mongodb shell sessions.&lt;/p&gt;

&lt;p&gt;In the first shell, perform inserts, e.g.,&lt;/p&gt;

&lt;p&gt;use test&lt;br/&gt;
db.cap1.insert( { &apos;msg&apos; : &apos;test&apos; } )&lt;/p&gt;

&lt;p&gt;In the second shell, attempt to track new insertions, e.g.,&lt;/p&gt;

&lt;p&gt;use test&lt;br/&gt;
db.cap1.find().addOption(34)  // 2 = tailable, 32 = await_data&lt;/p&gt;

&lt;p&gt;When running with 2.6.0, no updates are displayed.&lt;/p&gt;

&lt;p&gt;If a new capped collection is created using v2.6.0, and the shell commands above are run, the updates are displayed.&lt;/p&gt;&lt;/blockquote&gt;</description>
                <environment></environment>
        <key id="130674">SERVER-13562</key>
            <summary>Queries that use tailable cursors do not stream results if skip() is applied</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="david.storch@mongodb.com">David Storch</assignee>
                                    <reporter username="slg1013">Steve Green</reporter>
                        <labels>
                    </labels>
                <created>Fri, 11 Apr 2014 18:49:27 +0000</created>
                <updated>Mon, 11 Jul 2016 17:16:29 +0000</updated>
                            <resolved>Tue, 15 Apr 2014 02:46:48 +0000</resolved>
                                    <version>2.6.0</version>
                                    <fixVersion>2.6.1</fixVersion>
                    <fixVersion>2.7.0</fixVersion>
                                    <component>Querying</component>
                                        <votes>0</votes>
                                    <watches>12</watches>
                                                                                                                <comments>
                            <comment id="550850" author="xgen-internal-githook" created="Tue, 15 Apr 2014 22:45:47 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;dstorch&apos;, u&apos;name&apos;: u&apos;David Storch&apos;, u&apos;email&apos;: u&apos;david.storch@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-13562&quot; title=&quot;Queries that use tailable cursors do not stream results if skip() is applied&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-13562&quot;&gt;&lt;del&gt;SERVER-13562&lt;/del&gt;&lt;/a&gt; limit and skip stages no longer return eof without calling work() on the child&lt;/p&gt;

&lt;p&gt;Doing so could cause missing results for a tailable cursor.&lt;/p&gt;

&lt;p&gt;(cherry picked from commit 9d1f365bf8f0c3d6192284cffab4e3927722e17c)&lt;br/&gt;
Branch: v2.6&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/1b7b02db89e8a574cb2f5bff717090a8719d4fb9&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/1b7b02db89e8a574cb2f5bff717090a8719d4fb9&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="550792" author="david.storch" created="Tue, 15 Apr 2014 21:49:41 +0000"  >&lt;p&gt;A clarification on the behavior of tailable cursors combined with limit:&lt;/p&gt;

&lt;div class=&apos;table-wrap&apos;&gt;
&lt;table class=&apos;confluenceTable&apos;&gt;&lt;tbody&gt;
&lt;tr&gt;
&lt;th class=&apos;confluenceTh&apos;&gt;&amp;nbsp;&lt;/th&gt;
&lt;th class=&apos;confluenceTh&apos;&gt;2.4.x&lt;/th&gt;
&lt;th class=&apos;confluenceTh&apos;&gt;2.6.0&lt;/th&gt;
&lt;th class=&apos;confluenceTh&apos;&gt;2.6.1-pre-&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt; limit &amp;gt; 0 &lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt; no limit enforced &lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt; no limit enforced &lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt; no limit enforced &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt; limit &amp;lt; 0 &lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt; no limit enforced &lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt; one batch only (streaming broken) &lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt; limit enforced &lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;


&lt;p&gt;I think the 2.6.1-pre- behavior is reasonable in that usually limits don&apos;t apply to tailable cursors, but if you really want a limit you can use a negative value. &lt;/p&gt;</comment>
                            <comment id="549510" author="xgen-internal-githook" created="Tue, 15 Apr 2014 02:45:57 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;dstorch&apos;, u&apos;name&apos;: u&apos;David Storch&apos;, u&apos;email&apos;: u&apos;david.storch@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-13562&quot; title=&quot;Queries that use tailable cursors do not stream results if skip() is applied&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-13562&quot;&gt;&lt;del&gt;SERVER-13562&lt;/del&gt;&lt;/a&gt; limit and skip stages no longer return eof without calling work() on the child&lt;/p&gt;

&lt;p&gt;Doing so could cause missing results for a tailable cursor.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/9d1f365bf8f0c3d6192284cffab4e3927722e17c&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/9d1f365bf8f0c3d6192284cffab4e3927722e17c&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="546226" author="rassi@10gen.com" created="Sat, 12 Apr 2014 05:49:15 +0000"  >&lt;p&gt;Confirmed the issue; updated summary/description accordingly.  Thanks for the report.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=hari.khalsa%4010gen.com&quot; class=&quot;user-hover&quot; rel=&quot;hari.khalsa@10gen.com&quot;&gt;hari.khalsa@10gen.com&lt;/a&gt;, &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=david.storch&quot; class=&quot;user-hover&quot; rel=&quot;david.storch&quot;&gt;david.storch&lt;/a&gt;: please take a look.&lt;/p&gt;</comment>
                            <comment id="546050" author="slg1013" created="Sat, 12 Apr 2014 01:05:17 +0000"  >&lt;p&gt;Jason,&lt;/p&gt;

&lt;p&gt;I&apos;ve been playing with this all day, and I&apos;m now pretty convinced that the actual issue has nothing to do with capped collections created by older versions (although that may still be an issue, I don&apos;t really have any way to test it again, now that my server has been upgraded to 2.6).  What appears to be different is the way the &apos;skip&apos; parameter is handled on a v2.4 server compared to a v2.6 server in a query that results in a tailable cursor.&lt;/p&gt;

&lt;p&gt;The capped collections we have are used to hold audit logs.  I have scripts in several languages (e.g., perl, c) that use a tailable cursor to emulate the unix &apos;tail -f&apos; behavior.  So the script counts the number of entries in the collection, subtracts the number of entries we want to display, and uses the skip parameter in the query to set the cursor on the first record we want to display.  If I don&apos;t skip any records, the tailable cursor works as expected.  If I skip a single record, the tailable cursor never sees any new data (note that this was not a problem with v2.4).&lt;/p&gt;

&lt;p&gt;So, to reproduce the issue, create a capped collection and add 2 records (as described in the original post), then use the following command to create a tailable cursor&lt;/p&gt;

&lt;p&gt;db.cap1.find().skip(1).addOption(34)&lt;/p&gt;

&lt;p&gt;Now, when you add new data to the capped collection, the new entries are not displayed.&lt;/p&gt;

&lt;p&gt;The new entries are displayed when this is done on a v2.4 server&lt;/p&gt;</comment>
                            <comment id="546019" author="rassi@10gen.com" created="Sat, 12 Apr 2014 00:29:38 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=slg1013&quot; class=&quot;user-hover&quot; rel=&quot;slg1013&quot;&gt;slg1013&lt;/a&gt;: after following &quot;Steps to Reproduce&quot;, I am unable to reproduce your findings.  Can you give another set of instructions for reproducing either of the unexpected behaviors you&apos;re reporting on?&lt;/p&gt;</comment>
                            <comment id="545939" author="slg1013" created="Fri, 11 Apr 2014 23:06:39 +0000"  >&lt;p&gt;Perhaps I should file another bug, but I&apos;m seeing strange behavior with tailable cursors even for capped collections created with v2.6.0.  In one case, two capped collections created with the same command, where the tailable cursor appears to work with one and not the other; the only difference between the two collections being the number of documents inserted into each.  In another case, using a perl script, the tail seems to work initially, but after I restart the script, new data doesn&apos;t appear to be sent to the cursor.  I&apos;m not able to nail down any of these differences in behavior to a single cause...&lt;/p&gt;</comment>
                            <comment id="545662" author="slg1013" created="Fri, 11 Apr 2014 18:53:22 +0000"  >&lt;p&gt;I should have mentioned that this is a 64 bit Windows Server 2008 installation.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="130807">SERVER-13566</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>8.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_12451" key="com.atlassian.jira.plugin.system.customfieldtypes:multiversion">
                        <customfieldname>Backport Completed</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="13794">2.6.1</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 11 Apr 2014 22:52:27 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        9 years, 44 weeks, 1 day ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>ramon.fernandez@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            9 years, 44 weeks, 1 day ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_10032" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Operating System</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10026"><![CDATA[ALL]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>david.storch@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>rassi</customfieldvalue>
            <customfieldvalue>slg1013</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrlwzz:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrxxbb:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>112055</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_22870" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Triagers</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11861" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>User Summary</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="11858"><![CDATA[Completed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hs2uev:</customfieldvalue>

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