<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 20:55:24 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>[YANGTOOLS-1178] Add unique indices</title>
                <link>https://jira.opendaylight.org/browse/YANGTOOLS-1178</link>
                <project id="10188" key="YANGTOOLS">yangtools</project>
                    <description>&lt;p&gt;As a follow-up to &lt;a href=&quot;https://jira.opendaylight.org/browse/YANGTOOLS-1177&quot; title=&quot;Enforce unique constraints when opted-in&quot; class=&quot;issue-link&quot; data-issue-key=&quot;YANGTOOLS-1177&quot;&gt;&lt;del&gt;YANGTOOLS-1177&lt;/del&gt;&lt;/a&gt;, integrate unique enforcement into TreeNode lifecycle as an additional index.&lt;/p&gt;

&lt;p&gt;The problem of &lt;a href=&quot;https://jira.opendaylight.org/browse/YANGTOOLS-1177&quot; title=&quot;Enforce unique constraints when opted-in&quot; class=&quot;issue-link&quot; data-issue-key=&quot;YANGTOOLS-1177&quot;&gt;&lt;del&gt;YANGTOOLS-1177&lt;/del&gt;&lt;/a&gt; solution is that it does not scale to large lists with few modifications &#8211; as there is no previous-state-index, we end up examining all children of a modified list.&lt;/p&gt;

&lt;p&gt;In order to alleviate this, we need to keep further state in TreeNode &#8211; value vector/child node relation &#8211; and drive validation during TreeNode mutations.&lt;/p&gt;

&lt;p&gt;In steady state (in-between mutations) there is a unique mapping between a TreeNode child and a vector of unique constraint values (i.e. an invariant):&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;
BiMap&amp;lt;DataContainerNode, List&amp;lt;&lt;span class=&quot;code-object&quot;&gt;Object&lt;/span&gt;&amp;gt;&amp;gt; childToUnique;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;for each individual &apos;unique&apos; statement. Current implementation maintains this in a&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;
HashMultimap.&amp;lt;UniqueValidator&amp;lt;?&amp;gt;, List&amp;lt;&lt;span class=&quot;code-object&quot;&gt;Object&lt;/span&gt;&amp;gt;&amp;gt;&amp;gt; validatorToUnique;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;where a violation is triggered if a duplicate UniqueValidator/List&amp;lt;Object&amp;gt; mapping is being stored &#8211; effectively enforcing the invariant on steady state.&lt;/p&gt;

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

&lt;p&gt;Current implementation is not plugged into TreeNode mutation process and therefore is O(N) where N is the number of list entries. This obviously sucks for small modifications on large lists.&lt;/p&gt;

&lt;p&gt;The objective of this issue is to integrate UniqueValidation with TreeNode mutation process, so that unique enforcement will be O(N), &lt;b&gt;but&lt;/b&gt; where N is the number of &lt;b&gt;modified&lt;/b&gt; list entries.&lt;/p&gt;

&lt;p&gt;To achieve that we need to plug into ListModificationStrategy/MapModificationStrategy and perform a guided mutation:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;when we enter ListModificationStrategy.mutateChildren() we expand the &lt;b&gt;BiMap&lt;/b&gt; to a&#160;&lt;b&gt;HashMultimap&amp;lt;List&amp;lt;Object, TreeNode&amp;gt;&amp;gt;&lt;/b&gt;, where we track vector/child relationship&lt;/li&gt;
	&lt;li&gt;for each child, evaluate the vector mapped to that child, removing the old one and adding the new one&lt;/li&gt;
	&lt;li&gt;when we exit ListModificationStrategy.mutateChildren(), we check whether the&#160;&lt;b&gt;HashMultimap&lt;/b&gt; is convertible into a &lt;b&gt;BiMap&lt;/b&gt; &#8211; i.e. whether each vector has a unique child TreeNode. If it does not, we raise a violation&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Note that the resulting &lt;b&gt;BiMap&lt;/b&gt; will in reality be a BiMap for small lists &#8211; for large lists we need to decompose it to two TrieMaps, which co-evolve and maintain the mapping. This is because TrieMaps offer efficient amortized O(1) snapshot facility and partial modification.&lt;/p&gt;

&lt;p&gt;After we exit from ListModificationStrategy with a unique index, the resulting TreeNode needs to contain these indices so that the next mutation can pick up from there and manipulate just the delta. This will probably need a forwarding TreeNode implementation to hold the one/two maps.&lt;/p&gt;</description>
                <environment></environment>
        <key id="33574">YANGTOOLS-1178</key>
            <summary>Add unique indices</summary>
                <type id="10103" iconUrl="https://jira.opendaylight.org/secure/viewavatar?size=xsmall&amp;avatarId=10311&amp;avatarType=issuetype">New Feature</type>
                                            <priority id="3" iconUrl="https://jira.opendaylight.org/images/icons/priorities/major.svg">Medium</priority>
                        <status id="10003" iconUrl="https://jira.opendaylight.org/images/icons/status_generic.gif" description="">Confirmed</status>
                    <statusCategory id="2" key="new" colorName="blue-gray"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="rovarga">Robert Varga</reporter>
                        <labels>
                            <label>pt</label>
                    </labels>
                <created>Wed, 18 Nov 2020 22:56:52 +0000</created>
                <updated>Tue, 16 Jan 2024 14:48:09 +0000</updated>
                                                            <fixVersion>14.0.0</fixVersion>
                                    <component>data-impl</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                    <issuelinks>
                            <issuelinktype id="10000">
                    <name>Blocks</name>
                                            <outwardlinks description="blocks">
                                        <issuelink>
            <issuekey id="33575">YANGTOOLS-1179</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|i03wan:</customfieldvalue>

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