<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:17:49 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>[CDRIVER-3366] txn_opts_cleanup should reset max_commit_time_ms</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-3366</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;&lt;tt&gt;txn_opts_cleanup&lt;/tt&gt; is called from the following places:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;&lt;tt&gt;_mongoc_client_session_append_txn&lt;/tt&gt; when the state is &lt;tt&gt;COMMITTED&lt;/tt&gt;, &lt;tt&gt;COMMITTED_EMPTY&lt;/tt&gt;, or &lt;tt&gt;ABORTED&lt;/tt&gt;. The state will be reset to &lt;tt&gt;NONE&lt;/tt&gt; and the options reset.&lt;/li&gt;
	&lt;li&gt;&lt;tt&gt;mongoc_client_session_destroy&lt;/tt&gt;, when the session itself is freed&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;&lt;tt&gt;txn_opts_set&lt;/tt&gt; is called from the following places:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;&lt;tt&gt;_mongoc_client_session_new&lt;/tt&gt; when creating a new client session. Opts are set first from the client and then from explicit default options (if any) passed to &lt;tt&gt;start_session&lt;/tt&gt;&lt;/li&gt;
	&lt;li&gt;&lt;tt&gt;mongoc_client_session_start_transaction()&lt;/tt&gt; when starting a transaction. Opts are first set from the session&apos;s default options and then from explicit opts (if any) passed to &lt;tt&gt;start_transaction&lt;/tt&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;&lt;tt&gt;txn_opts_set&lt;/tt&gt; only assigns RC, WC, and RP if they are non-null. &lt;tt&gt;max_commit_time_ms&lt;/tt&gt; is only assigned if it is not &lt;tt&gt;DEFAULT_MAX_COMMIT_TIME_MS&lt;/tt&gt;, which is defined as zero. Since memory is zero-allocated, the initial options struct is correctly initialized with the default value for &lt;tt&gt;max_commit_time_ms&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;Since &lt;tt&gt;txn_opts_cleanup&lt;/tt&gt; never resets &lt;tt&gt;max_commit_time_ms&lt;/tt&gt;, I think it&apos;s possible for one transaction&apos;s &lt;tt&gt;max_commit_time_ms&lt;/tt&gt; to bleed over to the next. Consider a case where one transaction specifies a non-zero &lt;tt&gt;max_commit_time_ms&lt;/tt&gt;. That transaction ends (either committing or aborting). The next transaction starts and if the default transaction opts had no &lt;tt&gt;max_commit_time_ms&lt;/tt&gt; (i.e. the default), &lt;tt&gt;txn_opts_set&lt;/tt&gt; will leave the field as-is. I believe the correct fix for this is to have &lt;tt&gt;txn_opts_cleanup&lt;/tt&gt; also reset &lt;tt&gt;max_commit_time_ms&lt;/tt&gt; as it does the RC, WC, and RP pointers. It shouldn&apos;t be too hard to create a regression test for this as well.&lt;/p&gt;</description>
                <environment></environment>
        <key id="923851">CDRIVER-3366</key>
            <summary>txn_opts_cleanup should reset max_commit_time_ms</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="13201">Fixed</resolution>
                                        <assignee username="andreas.braun@mongodb.com">Andreas Braun</assignee>
                                    <reporter username="jmikola@mongodb.com">Jeremy Mikola</reporter>
                        <labels>
                    </labels>
                <created>Wed, 11 Sep 2019 21:25:32 +0000</created>
                <updated>Sat, 28 Oct 2023 11:29:06 +0000</updated>
                            <resolved>Wed, 6 Nov 2019 18:21:35 +0000</resolved>
                                    <version>1.15.0</version>
                                    <fixVersion>1.15.2</fixVersion>
                                    <component>Transactions</component>
                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="2520823" author="xgen-internal-githook" created="Wed, 6 Nov 2019 18:21:33 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;username&apos;: &apos;alcaeus&apos;, &apos;email&apos;: &apos;git@alcaeus.org&apos;, &apos;name&apos;: &apos;Andreas Braun&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-3366&quot; title=&quot;txn_opts_cleanup should reset max_commit_time_ms&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-3366&quot;&gt;&lt;del&gt;CDRIVER-3366&lt;/del&gt;&lt;/a&gt; reset max_commit_time_ms in txn_opts_cleanup&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/e995f437c3f14a443af35187d064d05124cefe82&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/e995f437c3f14a443af35187d064d05124cefe82&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2520815" author="xgen-internal-githook" created="Wed, 6 Nov 2019 18:20:07 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Andreas Braun&apos;, &apos;username&apos;: &apos;alcaeus&apos;, &apos;email&apos;: &apos;git@alcaeus.org&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-3366&quot; title=&quot;txn_opts_cleanup should reset max_commit_time_ms&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-3366&quot;&gt;&lt;del&gt;CDRIVER-3366&lt;/del&gt;&lt;/a&gt; reset max_commit_time_ms in txn_opts_cleanup&lt;br/&gt;
Branch: r1.15&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/258fbe3db85c86d57e03ec0660e1ac78c6ddf665&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/258fbe3db85c86d57e03ec0660e1ac78c6ddf665&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="774395">CDRIVER-3143</issuekey>
        </issuelink>
                            </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|hvedsv:</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>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>