<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:38:48 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-15726] Improve replication of $slice commands</title>
                <link>https://jira.mongodb.org/browse/SERVER-15726</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;We use slice for users activity feed limitation at website.&lt;br/&gt;
Now we use the limit 10 000, herewith enough quantity of data is stored, so total amount is 1350 kb approximately. While using replica set we met the following problem that there is big traffic to secondary nodes. Log analysis showed that while using slice object is always transferred totally via Internet. &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;2014-10-06T10:12:33.796+0000 [repl writer worker 2] warning: log line attempted (1349k) over max size (10k), printing beginning and end ... applying op: { ts: Timestamp 1412590353000|6, h: -4609969471965806062, v: 2, op: &quot;u&quot;, ns: &quot;dm_social.feed_activity&quot;, o2: { _id: 1 }, o: { $set: { log2: [ { time: &quot;1410172122&quot;, user_id: 100850514, name: &quot;NNNN&quot;, sex: 2, username: &quot;praisss&quot;, age: 26, country: &quot;NNNN&quot;, city: &quot;NNNN&quot; }, { time: &quot;1410172123&quot;, user_id: 100918283, name: &quot;NNNN&quot;, sex: 2, username: &quot;lydok0708&quot;, age: 35, country: &quot;NNNN&quot;, city: &quot;NNNN&quot; }, { time: &quot;1410172123&quot;, user_id: 101119576, name: &quot;NNNN&quot;, sex: 2, username: &quot;delfin51&quot;, age: 59, country: &quot;NNNN&quot;, city: &quot;NNNN&quot; }, { time: &quot;1410172129&quot;, user_id: 100908179, name: &quot;NNNN&quot;, sex: 2, username: &quot;lav13&quot;, age: 54, country: &quot;NNNN&quot;, city: &quot;NNNN&quot; }, &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;I would like to ask to improve slice function, so, when it is used, traffic for replicas would be the same as without slice being used.&lt;br/&gt;
Currently we solved the issue by using slice with probability of 1/100&lt;/p&gt;</description>
                <environment></environment>
        <key id="164419">SERVER-15726</key>
            <summary>Improve replication of $slice commands</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="9">Done</resolution>
                                        <assignee username="asya.kamsky@mongodb.com">Asya Kamsky</assignee>
                                    <reporter username="ngrebnev">Nikolay Grebnev</reporter>
                        <labels>
                    </labels>
                <created>Mon, 20 Oct 2014 05:56:40 +0000</created>
                <updated>Mon, 26 Nov 2018 20:24:27 +0000</updated>
                            <resolved>Mon, 26 Nov 2018 20:24:27 +0000</resolved>
                                    <version>2.6.5</version>
                                                    <component>Replication</component>
                                        <votes>0</votes>
                                    <watches>8</watches>
                                                                                                                <comments>
                            <comment id="2071976" author="asya" created="Mon, 26 Nov 2018 20:24:27 +0000"  >&lt;p&gt;As long as our replication relies on all operations being recorded in idempotent format, this cannot be changed.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="2071972" author="asya" created="Mon, 26 Nov 2018 20:23:56 +0000"  >&lt;p&gt;The issue is you are using $slice with negative offset which means we keep the &lt;b&gt;last&lt;/b&gt; N elements of the array after the $push.&lt;/p&gt;

&lt;p&gt;When that does not change the number of elements in the array, we detect it as a &quot;noop&quot; however, when this causes elements at the beginning of the array to be removed then each remaining element in the array changes position!&#160; &#160;So we have to record the new position of each element to make the operation idempotent, and therefore we cannot represent this operation in any other way.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="856974" author="ramon.fernandez" created="Wed, 18 Mar 2015 17:24:32 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=ngrebnev&quot; class=&quot;user-hover&quot; rel=&quot;ngrebnev&quot;&gt;ngrebnev&lt;/a&gt;, this is the current, expected behavior for &lt;tt&gt;$slice&lt;/tt&gt;. I&apos;m going to re-purpose this ticket as an improvement request as per your initial suggestion on the ticket.&lt;/p&gt;

&lt;p&gt;Regards,&lt;br/&gt;
Ram&#243;n.&lt;/p&gt;</comment>
                            <comment id="801787" author="ramon.fernandez" created="Sat, 10 Jan 2015 15:11:45 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=ngrebnev&quot; class=&quot;user-hover&quot; rel=&quot;ngrebnev&quot;&gt;ngrebnev&lt;/a&gt;, apologies for the long delay. I do see the behavior you describe, and I&apos;m investigating whether it is expected or not, and if it is whether there&apos;s room for improvement.&lt;/p&gt;

&lt;p&gt;It&apos;s easy to see how a &lt;tt&gt;$push&lt;/tt&gt; operation would only need to send the pushed elements to the secondaries, but a &lt;tt&gt;$slice&lt;/tt&gt; operation may change an array significantly so it could be that the only way to replicate such operation is to send the whole array to the secondaries.&lt;/p&gt;

&lt;p&gt;This being said, &lt;a href=&quot;http://askasya.com/post/largeembeddedarrays&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;having very large arrays in documents is often not a good idea&lt;/a&gt;, and if you&apos;re keeping logs of some kind you may want to investigate the use of capped collections.&lt;/p&gt;</comment>
                            <comment id="744998" author="ngrebnev" created="Mon, 20 Oct 2014 06:05:31 +0000"  >&lt;p&gt;$mongo&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;feed_activity&amp;#39;&amp;#93;&lt;/span&gt;.update(&lt;/p&gt;
{&apos;_id&apos;=&amp;gt;1}
&lt;p&gt;, {&apos;$push&apos;=&amp;gt;{log_name=&amp;gt;&lt;/p&gt;
{&apos;$each&apos;=&amp;gt;[info_hash],&apos;$slice&apos;=&amp;gt;-10000}
&lt;p&gt;}},{:upsert=&amp;gt;true})&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>5.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Sat, 10 Jan 2015 15:11:45 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        5 years, 11 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_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>asya.kamsky@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            5 years, 11 weeks, 2 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>asya.kamsky@mongodb.com</customfieldvalue>
            <customfieldvalue>ngrebnev</customfieldvalue>
            <customfieldvalue>ramon.fernandez@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrllb3:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>143462</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|hsgk47:</customfieldvalue>

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