-
Notifications
You must be signed in to change notification settings - Fork 133
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
Conversation
abe02fa
to
3fee9b5
Compare
// 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); | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/main/java/org/jboss/ejb/protocol/remote/RemotingEJBDiscoveryProvider.java
Show resolved
Hide resolved
3fee9b5
to
63e517f
Compare
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: fron->from
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
9e2be3e
to
3714de4
Compare
src/test/resources/last-node-to-leave-jboss-ejb-client.properties
Outdated
Show resolved
Hide resolved
src/test/resources/last-node-to-leave-jboss-ejb-client.properties
Outdated
Show resolved
Hide resolved
src/main/java/org/jboss/ejb/protocol/remote/RemotingEJBDiscoveryProvider.java
Show resolved
Hide resolved
3714de4
to
5782e51
Compare
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