<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:13:54 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-47346] Expose transaction-retry-helper as session object function</title>
                <link>https://jira.mongodb.org/browse/SERVER-47346</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;We should have an easy and standard way of dealing with transient transaction errors in our integration tests.&lt;/p&gt;

&lt;p&gt;The ideal solution would be something on the line of &lt;a href=&quot;https://api.mongodb.com/python/current/api/pymongo/client_session.html?#pymongo.client_session.ClientSession.with_transaction&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;with_transaction that is provided by the official python driver&lt;/a&gt;. A helper function exposed through &lt;a href=&quot;https://github.com/mongodb/mongo/blob/cac63cab472d04b46b691e52e014aa621939a418/src/mongo/shell/session.js#L669&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;the session object&lt;/a&gt; that takes a function and execute it inside a transaction and is capable of transparently retrying the transaction in the case of transient errors. Taking a quick look at our use-cases, it seems important to provide also the following functionality through this helper:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;Add an array parameter `ignoreErrors` to the function that allows to specify a list of error codes, for which we don&apos;t want to retry the transaction. This is useful for instance when &lt;a href=&quot;https://github.com/mongodb/mongo/blob/1d6cd3e2fbe7b31fab7c6d2dc73587c40ec66d56/jstests/core/txns/create_collection_parallel.js#L129&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;we want to be sure that a transient errors is happening&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;Add a boolean parameter `commit` to the function that allows to specify if the helper should also commit the transaction. This is helpful in those cases in which we want to perform &lt;a href=&quot;https://github.com/mongodb/mongo/blob/cac63cab472d04b46b691e52e014aa621939a418/jstests/core/txns/create_collection.js#L75&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;some actions before committing the transaction&lt;/a&gt;.&lt;/li&gt;
	&lt;li&gt;The helper function should also allow to &lt;a href=&quot;https://github.com/mongodb/mongo/blob/cac63cab472d04b46b691e52e014aa621939a418/jstests/core/txns/create_collection.js#L77&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;assert on the commit transaction status&lt;/a&gt;. This can be implemented by making the helper function return the commit status to allow any caller to assert on that.&lt;/li&gt;
	&lt;li&gt;As &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=maria.vankeulen&quot; class=&quot;user-hover&quot; rel=&quot;maria.vankeulen&quot;&gt;maria.vankeulen&lt;/a&gt; suggested we should limit the number of retries attempts. This will allow to catch infinite retries scenarios in our tests.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;At the moment we provide a &lt;a href=&quot;https://github.com/mongodb/mongo/blob/cac63cab472d04b46b691e52e014aa621939a418/jstests/concurrency/fsm_workload_helpers/auto_retry_transaction.js#L107&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;similar helper function&lt;/a&gt; that has the following limitations:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;It is not exposed as a function of the session object. This makes it difficult to find and also requires to always import `auto_retry_transaction.js` in order to use it.&lt;/li&gt;
	&lt;li&gt;It doesn&apos;t provide 1. It only allows to specify if the transaction should be retried on killed session.&lt;/li&gt;
	&lt;li&gt;It doesn&apos;t provide 2&lt;/li&gt;
	&lt;li&gt;It doesn&apos;t provide 3&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;We recently introduced &lt;a href=&quot;https://github.com/mongodb/mongo/blob/cac63cab472d04b46b691e52e014aa621939a418/jstests/libs/auto_retry_transaction_in_sharding.js#L61&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;another helper function&lt;/a&gt; that provides 2 but is very specific and has the same problems as the more general one above.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1305355">SERVER-47346</key>
            <summary>Expose transaction-retry-helper as session object function</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</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="12300">Won&apos;t Do</resolution>
                                        <assignee username="backlog-server-sharding">[DO NOT USE] Backlog - Sharding Team</assignee>
                                    <reporter username="tommaso.tocci@mongodb.com">Tommaso Tocci</reporter>
                        <labels>
                            <label>neweng</label>
                    </labels>
                <created>Mon, 6 Apr 2020 11:11:19 +0000</created>
                <updated>Tue, 6 Dec 2022 02:30:37 +0000</updated>
                            <resolved>Mon, 8 Nov 2021 17:48:55 +0000</resolved>
                                                                    <component>JavaScript</component>
                    <component>Testing Infrastructure</component>
                                        <votes>0</votes>
                                    <watches>6</watches>
                                                                                                                        <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25141"><![CDATA[Sharding]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        3 years, 44 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>alexander.golin@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            3 years, 44 weeks, 2 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>backlog-server-sharding</customfieldvalue>
            <customfieldvalue>tommaso.tocci@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hxdoav:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hx19l3:</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_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|hxdak7:</customfieldvalue>

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