<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 19:55:53 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>[CONTROLLER-1570] Leader state changed events received in reversed order</title>
                <link>https://jira.opendaylight.org/browse/CONTROLLER-1570</link>
                <project id="10113" key="CONTROLLER">controller</project>
                    <description>&lt;p&gt;When the ODL which is the leader of some shard is shutdown, one of the remaining ODL first receives two leader changed events, first event indicating new leader is selected and then the second event indicating the shard leader is null. The correct order of events received should be reversed.&lt;/p&gt;

&lt;p&gt;The scenario is described below:&lt;/p&gt;

&lt;p&gt;1)      6-nodes cluster (I am not sure the fact that cluster has more than 3 nodes is causing the problem because we always test with 3-nodes cluster)&lt;br/&gt;
2)      ODL node 1 is leader of some shard, say &#8216;shard-default-config&#8217;&lt;br/&gt;
3)      Now shutdown ODL1, the leader for &#8216;shard-default-config&#8217; is transferred to ODL2&lt;br/&gt;
4)      There are two events received by each node, first one indicates leader is null (current leader is no longer valid), the second for the new leader (ODL2) is selected.&lt;br/&gt;
5)      Four of the remaining ODL nodes receive the &#8216;onLeaderStateChanged&#8217; in that order&lt;br/&gt;
6)      Problem: ODL3 node receives the &#8216;onLeaderStateChanged&#8217; in reversed order. First it receives the event for new leader, &lt;br/&gt;
and then it receives the event for leader == null. This ODL node, based on the last event (leader==null), thinks that the &#8216;shard-default-config&#8217; shard has no leader and throws exception when there is a read/write to the shard.&lt;/p&gt;

&lt;p&gt;ReadFailedException&lt;/p&gt;
{message=Error executeRead ReadData for path /(urn:opendaylight:neutron?revision=2015-07-12)neutron/networks, errorList=[RpcError [message=Error executeRead ReadData for path /(urn:opendaylight:neutron?revision=2015-07-12)neutron/networks, severity=ERROR, errorType=APPLICATION, tag=operation-failed, applicationTag=null, info=null, cause=org.opendaylight.controller.md.sal.common.api.data.DataStoreUnavailableException: Shard member-3-shard-default-config currently has no leader. Try again later.]]}

&lt;p&gt;Below is the excerpt from karaf log filtered on the &#8216;onLeaderStateChanged&#8217; events when ODL1 is shut down. Please note the events for &#8216;shard-default-config&#8217;:&lt;/p&gt;

&lt;p&gt;2016-11-14 04:32:35,263 | INFO  | ult-dispatcher-6 | ShardManager                     | 195 - org.opendaylight.controller.sal-distributed-datastore - 1.4.1.Boron-SR1 | shard-manager-operational: Received LeaderStateChanged message: LeaderStateChanged &lt;span class=&quot;error&quot;&gt;&amp;#91;memberId=member-3-shard-default-operational, leaderId=null, leaderPayloadVersion=5&amp;#93;&lt;/span&gt;&lt;br/&gt;
2016-11-14 04:32:35,263 | INFO  | ult-dispatcher-6 | ShardManager                     | 195 - org.opendaylight.controller.sal-distributed-datastore - 1.4.1.Boron-SR1 | shard-manager-operational: Received LeaderStateChanged message: LeaderStateChanged &lt;span class=&quot;error&quot;&gt;&amp;#91;memberId=member-3-shard-entity-ownership-operational, leaderId=null, leaderPayloadVersion=5&amp;#93;&lt;/span&gt;&lt;br/&gt;
2016-11-14 04:32:35,263 | INFO  | ult-dispatcher-6 | ShardManager                     | 195 - org.opendaylight.controller.sal-distributed-datastore - 1.4.1.Boron-SR1 | shard-manager-operational: Received LeaderStateChanged message: LeaderStateChanged &lt;span class=&quot;error&quot;&gt;&amp;#91;memberId=member-3-shard-toaster-operational, leaderId=null, leaderPayloadVersion=5&amp;#93;&lt;/span&gt;&lt;br/&gt;
2016-11-14 04:32:35,263 | INFO  | ult-dispatcher-6 | ShardManager                     | 195 - org.opendaylight.controller.sal-distributed-datastore - 1.4.1.Boron-SR1 | shard-manager-operational: Received LeaderStateChanged message: LeaderStateChanged &lt;span class=&quot;error&quot;&gt;&amp;#91;memberId=member-3-shard-inventory-operational, leaderId=null, leaderPayloadVersion=5&amp;#93;&lt;/span&gt;&lt;br/&gt;
2016-11-14 04:32:35,263 | INFO  | ult-dispatcher-6 | ShardManager                     | 195 - org.opendaylight.controller.sal-distributed-datastore - 1.4.1.Boron-SR1 | shard-manager-operational: Received LeaderStateChanged message: LeaderStateChanged &lt;span class=&quot;error&quot;&gt;&amp;#91;memberId=member-3-shard-topology-operational, leaderId=null, leaderPayloadVersion=5&amp;#93;&lt;/span&gt;&lt;br/&gt;
2016-11-14 04:32:35,318 | INFO  | ult-dispatcher-6 | ShardManager                     | 195 - org.opendaylight.controller.sal-distributed-datastore - 1.4.1.Boron-SR1 | shard-manager-operational: Received LeaderStateChanged message: LeaderStateChanged &lt;span class=&quot;error&quot;&gt;&amp;#91;memberId=member-3-shard-inventory-operational, leaderId=member-4-shard-inventory-operational, leaderPayloadVersion=5&amp;#93;&lt;/span&gt;&lt;br/&gt;
2016-11-14 04:32:35,318 | INFO  | ult-dispatcher-6 | ShardManager                     | 195 - org.opendaylight.controller.sal-distributed-datastore - 1.4.1.Boron-SR1 | shard-manager-operational: Received LeaderStateChanged message: LeaderStateChanged &lt;span class=&quot;error&quot;&gt;&amp;#91;memberId=member-3-shard-default-operational, leaderId=member-4-shard-default-operational, leaderPayloadVersion=5&amp;#93;&lt;/span&gt;&lt;br/&gt;
2016-11-14 04:32:35,322 | INFO  | ult-dispatcher-2 | ShardManager                     | 195 - org.opendaylight.controller.sal-distributed-datastore - 1.4.1.Boron-SR1 | shard-manager-operational: Received LeaderStateChanged message: LeaderStateChanged &lt;span class=&quot;error&quot;&gt;&amp;#91;memberId=member-3-shard-entity-ownership-operational, leaderId=member-4-shard-entity-ownership-operational, leaderPayloadVersion=5&amp;#93;&lt;/span&gt;&lt;br/&gt;
2016-11-14 04:32:35,330 | INFO  | ult-dispatcher-5 | ShardManager                     | 195 - org.opendaylight.controller.sal-distributed-datastore - 1.4.1.Boron-SR1 | shard-manager-operational: Received LeaderStateChanged message: LeaderStateChanged &lt;span class=&quot;error&quot;&gt;&amp;#91;memberId=member-3-shard-toaster-operational, leaderId=member-2-shard-toaster-operational, leaderPayloadVersion=5&amp;#93;&lt;/span&gt;&lt;br/&gt;
2016-11-14 04:32:35,331 | INFO  | ult-dispatcher-5 | ShardManager                     | 195 - org.opendaylight.controller.sal-distributed-datastore - 1.4.1.Boron-SR1 | shard-manager-operational: Received LeaderStateChanged message: LeaderStateChanged &lt;span class=&quot;error&quot;&gt;&amp;#91;memberId=member-3-shard-topology-operational, leaderId=member-2-shard-topology-operational, leaderPayloadVersion=5&amp;#93;&lt;/span&gt;&lt;br/&gt;
2016-11-14 04:32:35,441 | INFO  | lt-dispatcher-16 | ShardManager                     | 195 - org.opendaylight.controller.sal-distributed-datastore - 1.4.1.Boron-SR1 | shard-manager-config: Received LeaderStateChanged message: LeaderStateChanged &lt;span class=&quot;error&quot;&gt;&amp;#91;memberId=member-3-shard-inventory-config, leaderId=member-5-shard-inventory-config, leaderPayloadVersion=5&amp;#93;&lt;/span&gt;&lt;br/&gt;
2016-11-14 04:32:35,441 | INFO  | lt-dispatcher-16 | ShardManager                     | 195 - org.opendaylight.controller.sal-distributed-datastore - 1.4.1.Boron-SR1 | shard-manager-config: Received LeaderStateChanged message: LeaderStateChanged &lt;span class=&quot;error&quot;&gt;&amp;#91;memberId=member-3-shard-inventory-config, leaderId=null, leaderPayloadVersion=5&amp;#93;&lt;/span&gt;&lt;br/&gt;
2016-11-14 04:32:35,442 | INFO  | lt-dispatcher-18 | ShardManager                     | 195 - org.opendaylight.controller.sal-distributed-datastore - 1.4.1.Boron-SR1 | shard-manager-config: Received LeaderStateChanged message: LeaderStateChanged &lt;span class=&quot;error&quot;&gt;&amp;#91;memberId=member-3-shard-toaster-config, leaderId=member-5-shard-toaster-config, leaderPayloadVersion=5&amp;#93;&lt;/span&gt;&lt;br/&gt;
2016-11-14 04:32:35,442 | INFO  | lt-dispatcher-18 | ShardManager                     | 195 - org.opendaylight.controller.sal-distributed-datastore - 1.4.1.Boron-SR1 | shard-manager-config: Received LeaderStateChanged message: LeaderStateChanged &lt;span class=&quot;error&quot;&gt;&amp;#91;memberId=member-3-shard-default-config, leaderId=member-2-shard-default-config, leaderPayloadVersion=5&amp;#93;&lt;/span&gt;&lt;br/&gt;
2016-11-14 04:32:35,442 | INFO  | lt-dispatcher-18 | ShardManager                     | 195 - org.opendaylight.controller.sal-distributed-datastore - 1.4.1.Boron-SR1 | shard-manager-config: Received LeaderStateChanged message: LeaderStateChanged &lt;span class=&quot;error&quot;&gt;&amp;#91;memberId=member-3-shard-toaster-config, leaderId=null, leaderPayloadVersion=5&amp;#93;&lt;/span&gt;&lt;br/&gt;
2016-11-14 04:32:35,442 | INFO  | lt-dispatcher-18 | ShardManager                     | 195 - org.opendaylight.controller.sal-distributed-datastore - 1.4.1.Boron-SR1 | shard-manager-config: Received LeaderStateChanged message: LeaderStateChanged &lt;span class=&quot;error&quot;&gt;&amp;#91;memberId=member-3-shard-topology-config, leaderId=member-5-shard-topology-config, leaderPayloadVersion=5&amp;#93;&lt;/span&gt;&lt;br/&gt;
2016-11-14 04:32:35,442 | INFO  | ult-dispatcher-4 | ShardManager                     | 195 - org.opendaylight.controller.sal-distributed-datastore - 1.4.1.Boron-SR1 | shard-manager-config: Received LeaderStateChanged message: LeaderStateChanged &lt;span class=&quot;error&quot;&gt;&amp;#91;memberId=member-3-shard-topology-config, leaderId=null, leaderPayloadVersion=5&amp;#93;&lt;/span&gt;&lt;br/&gt;
2016-11-14 04:32:35,455 | INFO  | lt-dispatcher-16 | ShardManager                     | 195 - org.opendaylight.controller.sal-distributed-datastore - 1.4.1.Boron-SR1 | shard-manager-config: Received LeaderStateChanged message: LeaderStateChanged &lt;span class=&quot;error&quot;&gt;&amp;#91;memberId=member-3-shard-default-config, leaderId=null, leaderPayloadVersion=5&amp;#93;&lt;/span&gt;&lt;/p&gt;</description>
                <environment>&lt;p&gt;Operating System: All&lt;br/&gt;
Platform: All&lt;/p&gt;</environment>
        <key id="26124">CONTROLLER-1570</key>
            <summary>Leader state changed events received in reversed order</summary>
                <type id="10104" iconUrl="https://jira.opendaylight.org/secure/viewavatar?size=xsmall&amp;avatarId=10303&amp;avatarType=issuetype">Bug</type>
                                                <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="-1">Unassigned</assignee>
                                    <reporter username="vinh.nguyen@hcl.com">Vinh Nguyen</reporter>
                        <labels>
                    </labels>
                <created>Thu, 15 Dec 2016 23:58:50 +0000</created>
                <updated>Tue, 25 Jul 2023 08:24:16 +0000</updated>
                            <resolved>Thu, 22 Dec 2016 14:07:00 +0000</resolved>
                                                                    <component>clustering</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="51646" author="vinh.nguyen@hcl.com" created="Fri, 16 Dec 2016 00:00:53 +0000"  >&lt;p&gt;Attachment ODL1_karaf.zip has been added with description: karaf.log ODL1&lt;/p&gt;</comment>
                            <comment id="51647" author="vinh.nguyen@hcl.com" created="Fri, 16 Dec 2016 00:01:26 +0000"  >&lt;p&gt;Attachment ODL2_karaf.zip has been added with description: karaf.log ODL2&lt;/p&gt;</comment>
                            <comment id="51648" author="vinh.nguyen@hcl.com" created="Fri, 16 Dec 2016 00:03:20 +0000"  >&lt;p&gt;Attachment ODL3_karaf.zip has been added with description: karaf.log ODL3 - This ODL received leader changed events in wrong order&lt;/p&gt;</comment>
                            <comment id="51649" author="vinh.nguyen@hcl.com" created="Fri, 16 Dec 2016 00:03:48 +0000"  >&lt;p&gt;Attachment ODL4_karaf.zip has been added with description: karaf.log ODL4&lt;/p&gt;</comment>
                            <comment id="51650" author="vinh.nguyen@hcl.com" created="Fri, 16 Dec 2016 00:04:16 +0000"  >&lt;p&gt;Attachment ODL5_karaf.zip has been added with description: karaf.log ODL5&lt;/p&gt;</comment>
                            <comment id="51651" author="vinh.nguyen@hcl.com" created="Fri, 16 Dec 2016 00:04:40 +0000"  >&lt;p&gt;Attachment ODL6_karaf.zip has been added with description: karaf.log ODL6&lt;/p&gt;</comment>
                            <comment id="51643" author="tpantelis" created="Wed, 21 Dec 2016 11:48:57 +0000"  >&lt;p&gt;Was ODL3/member-3 a non-voting member by any chance?&lt;/p&gt;</comment>
                            <comment id="51644" author="tpantelis" created="Wed, 21 Dec 2016 14:33:38 +0000"  >&lt;p&gt;Strike that. I think I know the problem. On leader transition, the current leader first sends out LeaderTransitioning events to each follower to tell them the current leader is being deposed. The followers then send out a LeaderStateChange event with a null leaderId which is picked up by the ShardManager to delay subsequent transactions activity to the shard until a new leader is elected. However it&apos;s possible the LeaderStateChange message does not reach a follower until after the leader transition occurs (eg due to dispatching delay in the caller or the network). This results in a LeaderStateChange event with a null leaderId being delivered after the LeaderStateChange with the new leaderId. I wrote a unit test that reproduces it.&lt;/p&gt;

&lt;p&gt;We need to handle LeaderTransitioning events in a CAS-like manner, ie include the leaderId with the LeaderTransitioning message and only issue the LeaderStateChange event with a null leaderId if the current leaderId matches the leaderId in the LeaderTransitioning message.&lt;/p&gt;

&lt;p&gt;(In reply to Tom Pantelis from comment #7)&lt;br/&gt;
&amp;gt; Was ODL3/member-3 a non-voting member by any chance?&lt;/p&gt;</comment>
                            <comment id="51645" author="tpantelis" created="Wed, 21 Dec 2016 14:34:28 +0000"  >&lt;p&gt;Submitted &lt;a href=&quot;https://git.opendaylight.org/gerrit/#/c/49701/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://git.opendaylight.org/gerrit/#/c/49701/&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="13600" name="ODL1_karaf.zip" size="30934" author="vinh.nguyen@hcl.com" created="Fri, 16 Dec 2016 00:00:53 +0000"/>
                            <attachment id="13601" name="ODL2_karaf.zip" size="51757" author="vinh.nguyen@hcl.com" created="Fri, 16 Dec 2016 00:01:26 +0000"/>
                            <attachment id="13602" name="ODL3_karaf.zip" size="134092" author="vinh.nguyen@hcl.com" created="Fri, 16 Dec 2016 00:03:20 +0000"/>
                            <attachment id="13603" name="ODL4_karaf.zip" size="51305" author="vinh.nguyen@hcl.com" created="Fri, 16 Dec 2016 00:03:48 +0000"/>
                            <attachment id="13604" name="ODL5_karaf.zip" size="50700" author="vinh.nguyen@hcl.com" created="Fri, 16 Dec 2016 00:04:16 +0000"/>
                            <attachment id="13605" name="ODL6_karaf.zip" size="48214" author="vinh.nguyen@hcl.com" created="Fri, 16 Dec 2016 00:04:40 +0000"/>
                    </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_10208" key="com.atlassian.jira.plugin.system.customfieldtypes:textfield">
                        <customfieldname>External issue ID</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>7391</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10201" key="com.atlassian.jira.plugin.system.customfieldtypes:url">
                        <customfieldname>External issue URL</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[https://bugs.opendaylight.org/show_bug.cgi?id=7391]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10206" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Issue Type</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10300"><![CDATA[Bug]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10204" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>ODL SR Target Milestone</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10344"><![CDATA[Boron-3]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_10000" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|i02rdz:</customfieldvalue>

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