Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EJBCLIENT-325] Clean up crashed/shutdown singleton cluster nodes from DNR #380

Merged
merged 1 commit into from
Mar 26, 2019

Conversation

rachmatowicz
Copy link
Contributor

This PR aims to remove stale Discovered Node Registry (DNR) entries corresponding to singleton cluster nodes which are no longer available, let alone connected. This can happen when the last node of a cluster leaves, or crashes. For example, if a client invokes on a cluster with one member node1 and that member crashes, then a new member node2 joins, the client will see membership as {node1, node2} which is incorrect. This is due to the fact that the client depends on externally generated information (i.e. topology updates) to keep the DNR up to date.

For details of the fix, see: https://issues.jboss.org/browse/EJBCLIENT-325

// keep a record of this URI if it has an associated cluster (EJBCLIENT-325)
if (clusterEffective != null) {
urisByCluster.computeIfAbsent(clusterEffective, ignored -> Collections.newSetFromMap(new ConcurrentHashMap<>())).add(uri);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to me that we are only creating the entry for the first node. What about a scenario that we are connecting to another node of a cluster but there is already an entry for that custer in urisByCluster map. Shouldn't we add the node there as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually does allow multiple entries to be added. If i'm not mistaken, if we call computeIfAbsent and there is no Set value associated with the key, it will be created and returned; otherwise, the existing value will be returned. In either case, the new uri will be added to the Set returned as a value. I'm also seeing sets with multiple URI entries in my logs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, you are right

* However, if we call it with a cluster name, indicating that we are connecting to a cluster, instead of looking up the AuthenticationContext
* for the cluster member destination, it instead uses the AuthenticationContext for the URI which first connected to the cluster.
* This is the cluster effective URI, in the sense thatit is an effective URI (i.e. resolved) for a cluster - the same credentials will be used
* no matter which cluster member we connect to.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which word is the typo? the thatit ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

if (Logs.INVOCATION.isDebugEnabled()) {
Logs.INVOCATION.debugf("Received CLUSTER_TOPOLOGY_NODE_REMOVAL(%x) message from %s for (cluster, node) = (%s, %s)", msg, remoteEndpoint, clusterName, nodeName);
Logs.INVOCATION.debugf("Received CLUSTER_TOPOLOGY_NODE_REMOVAL(%x) message fron node %s for (cluster, node) = (%s, %s)", msg, remoteEndpoint, clusterName, nodeName);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: fron->from

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@rachmatowicz rachmatowicz force-pushed the EJBCLIENT-325 branch 5 times, most recently from 9e2be3e to 3714de4 Compare March 25, 2019 12:23
@tadamski tadamski merged commit c2b31d7 into wildfly:4.0 Mar 26, 2019
@rachmatowicz rachmatowicz deleted the EJBCLIENT-325 branch March 27, 2019 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants