The markedAsSeniorClusterMember event is not fired when a node becomes senior

Description

Steps to reproduce;

Register a ClusterEventListener in a plugin. Start the plugin on a junior node in a two node cluster.

Kill the senior node in the cluster.

Wait until the remaining node is promoted.

Expected results;

The ClusterEventListener.leftCluster(byte[]) and ClusterEventListener.markedAsSeniorMember() events are fired. 

Actual results:

Whilst the leftCluster(byte[]) event is fired, the markedAsSeniorMember() event is not.

Environment

None

Activity

Show:

Greg Thomas February 8, 2018 at 5:11 PM

Initial investigation, so I remember for later;

This happens because ClusterListener initialises seniorClusterMember on creation by calling CacheFactory.isSeniorClusterMember(). This returns true when the server first starts. Because ClusterListener already thinks it's senior, it never sends the markedAsSeniorMember() event when the other node leaves.

An easy fix (tested) is to simply set seniorClusterMember = false on creation; it will be set to true when the node starts a new cluster. 

But I'm more concerned that CacheFactory.isSeniorClusterMember() is returning true; At that point in time it shouldn't be as the node is never a senior member.

Fixed

Details

Assignee

Reporter

Fix versions

Priority

Created February 8, 2018 at 4:27 PM
Updated February 12, 2018 at 12:04 PM
Resolved February 12, 2018 at 12:04 PM