<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:49:13 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-60202] Speed up isOnStepRelativeTo() with binary search</title>
                <link>https://jira.mongodb.org/browse/SERVER-60202</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Numeric ranges use some modulo arithmetic to determine whether a given value is on-step relative to the lower bound of an explicit range in constant time, and and date ranges with units that are smaller than one month use the same, after converting the dates to milliseconds. Time units that are a month long are longer cannot be represented with a constant number of milliseconds due to different lengths of months and leap days in different years. The current solution is to iterate up from the lower bound, incrementing by the step defined in the range, until the given value is either met (on step) or passed (off step).&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;This function is called once for every document generated and could lead to performance issues in edge cases where there are lots of off-step documents between existing ones.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;The function could be sped up to perform a binary search for the given value rather than iterating up from the bottom of the range. Investigate after writing performance tests to see if a considerable amount of time is being spent inside this function for the affected time units.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1882878">SERVER-60202</key>
            <summary>Speed up isOnStepRelativeTo() with binary search</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="backlog-query-optimization">Backlog - Query Optimization</assignee>
                                    <reporter username="davis.haupt@mongodb.com">Davis Haupt</reporter>
                        <labels>
                    </labels>
                <created>Fri, 24 Sep 2021 15:18:09 +0000</created>
                <updated>Tue, 6 Dec 2022 00:54:49 +0000</updated>
                            <resolved>Mon, 4 Oct 2021 15:30:25 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="4099677" author="davis.haupt" created="Mon, 4 Oct 2021 15:30:25 +0000"  >&lt;p&gt;Left comment on the ticket that performance differences observed in testing can&apos;t be explained by isOnStepRelativeTo(), so this optimization is not necessary.&lt;/p&gt;</comment>
                            <comment id="4099616" author="davis.haupt" created="Mon, 4 Oct 2021 15:28:58 +0000"  >&lt;p&gt;After PERF-2380, it&apos;s clear that for densification workloads, pipelines working with numeric and millisecond step units run with similar latencies, and pipelines working with hour and month step units run about slower, especially with partitions and smaller steps. It would make sense that any discrepancy would be more visible with those settings since smaller step sizes and partitioning the collection both result in more documents being generated. The gaps are visible even in the &lt;tt&gt;range: &quot;full&quot;&lt;/tt&gt;&#160;case with no partitions, however, which is one piece of evidence to suggest that the discrepancies are not directly related to this function.&lt;/p&gt;

&lt;p&gt;What&apos;s interesting is that month and hour step units are so similar. If there was an inefficiency within &lt;tt&gt;isOnStepRelativeTo()&lt;/tt&gt;, I would expect hour to be grouped with millisecond and numeric units.&#160; I would guess that the differing performance for numeric steps and date units larger than millisecond lies in the implementation of &lt;a href=&quot;https://github.com/mongodb/mongo/blob/f369292c627896fac3b7542974fd12bc509aef7c/src/mongo/db/query/datetime/date_time_support.cpp#L1179&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;dateAdd()&lt;/tt&gt;&#160;function&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="4089771" author="davis.haupt" created="Tue, 28 Sep 2021 16:46:46 +0000"  >&lt;p&gt;After some refactoring and optimization, isOnStepRelativeTo() is only being called with `_current` as the base rather than any lower bound. Since `_current` is generally being updated/incremented as documents are generated, this makes it very likely that there will never be a loop with more than a few iterations, even in the worst case. This should be confirmed with PERF-2381, but if there is no real difference between constant and variable-length unit durations, then this ticket can be closed.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="1889499">SERVER-60447</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>3.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25126"><![CDATA[Query Optimization]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        2 years, 18 weeks, 2 days 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_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-1934</customfieldvalue>
                        </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>alexander.golin@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            2 years, 18 weeks, 2 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>backlog-query-optimization</customfieldvalue>
            <customfieldvalue>davis.haupt@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i032vz:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr2o7b:</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_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </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_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i02p1b:</customfieldvalue>

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