<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 20:10:56 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>OpenDaylight JIRA</title>
    <link>https://jira.opendaylight.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>8.20.10</version>
        <build-number>820010</build-number>
        <build-date>22-06-2022</build-date>
    </build-info>


<item>
            <title>[MDSAL-775] Do not allow cross-datastore transactions</title>
                <link>https://jira.opendaylight.org/browse/MDSAL-775</link>
                <project id="10137" key="MDSAL">mdsal</project>
                    <description>&lt;p&gt;The ability to access multiple datastores in a single transaction is something we supported on a best-effort basis, but there is no concept of cross-datastore atomicity.&lt;/p&gt;

&lt;p&gt;As such, no downstreams should be using this facility &#8211; remove this ability, forcing users to have a separate transaction for each datastore.&lt;/p&gt;</description>
                <environment></environment>
        <key id="36226">MDSAL-775</key>
            <summary>Do not allow cross-datastore transactions</summary>
                <type id="10101" iconUrl="https://jira.opendaylight.org/secure/viewavatar?size=xsmall&amp;avatarId=10318&amp;avatarType=issuetype">Task</type>
                                            <priority id="3" iconUrl="https://jira.opendaylight.org/images/icons/priorities/major.svg">Medium</priority>
                        <status id="5" iconUrl="https://jira.opendaylight.org/images/icons/statuses/resolved.png" description="A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.">Resolved</status>
                    <statusCategory id="3" key="done" colorName="green"/>
                                    <resolution id="10000">Done</resolution>
                                        <assignee username="rkashapov">Ruslan Kashapov</assignee>
                                    <reporter username="rovarga">Robert Varga</reporter>
                        <labels>
                            <label>pt</label>
                    </labels>
                <created>Mon, 10 Oct 2022 08:23:28 +0000</created>
                <updated>Tue, 8 Nov 2022 12:23:28 +0000</updated>
                            <resolved>Mon, 7 Nov 2022 16:08:48 +0000</resolved>
                                                    <fixVersion>11.0.0</fixVersion>
                                    <component>DOM runtime</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="71545" author="JIRAUSER13216" created="Thu, 13 Oct 2022 09:34:27 +0000"  >&lt;p&gt;there is a limitation to what can be done as solution for current task&lt;br/&gt;
due to the way the datastore being addressed using current API.&lt;/p&gt;

&lt;p&gt;in order to operate with data from a specific datastore the composite transaction&#160;&lt;br/&gt;
object should be created first, then only datastore will be addressed as an&lt;br/&gt;
argument of read/write operation like below&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
&lt;span class=&quot;code-keyword&quot;&gt;final&lt;/span&gt; WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
tx.merge(LogicalDatastoreType.CONFIGURATION, DATA_IID, data); &lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;it means backing transactions for all the datastores require to be instantiated&lt;br/&gt;
before the actual datastore is mentioned.&lt;/p&gt;

&lt;p&gt;the composite transaction is being created by dataBroker from the set of datastores&lt;br/&gt;
provided on databroker initialization. it means in order to have single backing transaction&lt;br/&gt;
within composite one the dataBroker have to be always initialized with single datastore.&lt;/p&gt;

&lt;p&gt;necessity to have separate databroker instance for each datastore isn&apos;t suitable&lt;br/&gt;
with current usage of databroker, it means no backward compatibility.&lt;/p&gt;

&lt;p&gt;#1&lt;/p&gt;

&lt;p&gt;the compromise solution could be logical restriction within transaction itself by controlling&lt;br/&gt;
the datastore type to match the first requested one like shown below&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
&lt;span class=&quot;code-keyword&quot;&gt;final&lt;/span&gt; WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
tx.merge(LogicalDatastoreType.CONFIGURATION, DATA_IID, data); &lt;span class=&quot;code-comment&quot;&gt;// first operation, datastore type registered&#160;
&lt;/span&gt;tx.merge(LogicalDatastoreType.CONFIGURATION, DATA_IID2, data2); &lt;span class=&quot;code-comment&quot;&gt;// datastore matches, passed ok
&lt;/span&gt;tx.merge(LogicalDatastoreType.OPERATIONAL, DATA_IID, data); &lt;span class=&quot;code-comment&quot;&gt;// datastore mismatches, exception thrown &lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;while this approach solves &apos;single datastore per transaction&apos; while API remain as is,&lt;br/&gt;
in fact the update will bring no benefits: no optimization (same backing transactions require&#160;&lt;br/&gt;
instantiation anyway), no inner logic modified, just introducing annoying extra restriction&#160;&lt;br/&gt;
causing inobvious backward incompatibility (for those addressing different datastores in same&#160;&lt;br/&gt;
transaction new exception will be introduced).&lt;/p&gt;

&lt;p&gt;#2&lt;/p&gt;

&lt;p&gt;imo more reasonable approach would be introducing new api using single store transactions,&lt;br/&gt;
with gradual migration (deprecate old api first, remove deprecated api and classes later).&lt;br/&gt;
so the transaction will be initially tied to single datastore, so it became unnecessary&#160;&lt;br/&gt;
as an operation argument, the code will look like below&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
&lt;span class=&quot;code-comment&quot;&gt;// &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; transaction interfaces, &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; databroker methods to build single datastore transactions
&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;final&lt;/span&gt; DatastoreWriteTransaction tx = dataBroker.newWriteOnlyTransaction(LogicalDatastoreType.CONFIGURATION);
tx.merge(DATA_IID, data); &lt;span class=&quot;code-comment&quot;&gt;// datastore is known already&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;while this approach seems more future-proof, it also requires more effort and a new set of &lt;br/&gt;
transaction related interfaces to be introduced&lt;/p&gt;

&lt;p&gt;#3&lt;br/&gt;
another compromise (with keeping existing API) could be limiting number of&#160; backed transactions if&lt;br/&gt;
is to add databroker method to build composite transaction with single backing transaction&#160;&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
&lt;span class=&quot;code-comment&quot;&gt;// old transaction interfaces, &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; databroker methods 
&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;final&lt;/span&gt; WriteTransaction tx = dataBroker.newWriteOnlyTransaction(LogicalDatastoreType.CONFIGURATION);
tx.merge(LogicalDatastoreType.CONFIGURATION, DATA_IID, data); &lt;span class=&quot;code-comment&quot;&gt;// ok
&lt;/span&gt;tx.merge(LogicalDatastoreType.OPERATIONAL, DATA_IID, data); &lt;span class=&quot;code-comment&quot;&gt;// IllegalStateException, current behavior&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;the approach need to be clarified&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="71546" author="rovarga" created="Thu, 13 Oct 2022 10:58:14 +0000"  >&lt;p&gt;Approach 1, definitely, as we need to catch violations first and allow &lt;b&gt;implementations&lt;/b&gt; to rely on the fact this is not allowed.&lt;/p&gt;

&lt;p&gt;We have datastore-bound versions of the WriteTransaction et al. prepared, but rolling those out is going to be a point.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10300">
                    <name>Issue split</name>
                                            <outwardlinks description="split to">
                                        <issuelink>
            <issuekey id="36303">CONTROLLER-2055</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                            <customfield id="customfield_11400" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10000" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|i0433b:</customfieldvalue>

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