You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by mc...@apache.org on 2018/10/09 19:25:10 UTC
nifi git commit: NIFI-5672: Do not compare Load Balancing
address/port for logical equivalence of Node Identifiers. Added more details
to logging of Node Identifiers
Repository: nifi
Updated Branches:
refs/heads/master 77edddd98 -> 9dfc6683e
NIFI-5672: Do not compare Load Balancing address/port for logical equivalence of Node Identifiers. Added more details to logging of Node Identifiers
This closes #3054
Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/9dfc6683
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/9dfc6683
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/9dfc6683
Branch: refs/heads/master
Commit: 9dfc6683eef93290f118ccf6bc2b93f6370bddc5
Parents: 77edddd
Author: Mark Payne <ma...@hotmail.com>
Authored: Tue Oct 9 12:19:24 2018 -0400
Committer: Matt Gilman <ma...@gmail.com>
Committed: Tue Oct 9 15:24:43 2018 -0400
----------------------------------------------------------------------
.../nifi/cluster/protocol/NodeIdentifier.java | 20 ++++++++++++--------
.../node/NodeClusterCoordinator.java | 15 ++++++++-------
2 files changed, 20 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/nifi/blob/9dfc6683/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster-protocol/src/main/java/org/apache/nifi/cluster/protocol/NodeIdentifier.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster-protocol/src/main/java/org/apache/nifi/cluster/protocol/NodeIdentifier.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster-protocol/src/main/java/org/apache/nifi/cluster/protocol/NodeIdentifier.java
index b17ec2b..56f9a24 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster-protocol/src/main/java/org/apache/nifi/cluster/protocol/NodeIdentifier.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster-protocol/src/main/java/org/apache/nifi/cluster/protocol/NodeIdentifier.java
@@ -23,6 +23,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.Collections;
import java.util.HashSet;
+import java.util.Objects;
import java.util.Set;
/**
@@ -254,24 +255,21 @@ public class NodeIdentifier {
if (other == null) {
return false;
}
- if ((this.apiAddress == null) ? (other.apiAddress != null) : !this.apiAddress.equals(other.apiAddress)) {
+ if (other == this) {
+ return true;
+ }
+ if (!Objects.equals(apiAddress, other.apiAddress)) {
return false;
}
if (this.apiPort != other.apiPort) {
return false;
}
- if ((this.socketAddress == null) ? (other.socketAddress != null) : !this.socketAddress.equals(other.socketAddress)) {
+ if (!Objects.equals(socketAddress, other.socketAddress)) {
return false;
}
if (this.socketPort != other.socketPort) {
return false;
}
- if (!this.loadBalanceAddress.equals(other.loadBalanceAddress)) {
- return false;
- }
- if (this.loadBalancePort != other.loadBalancePort) {
- return false;
- }
return true;
}
@@ -288,4 +286,10 @@ public class NodeIdentifier {
return apiAddress + ":" + apiPort;
}
+ public String getFullDescription() {
+ return "NodeIdentifier[UUID=" + id + ", API Address = " + apiAddress + ":" + apiPort + ", Cluster Socket Address = " + socketAddress + ":" + socketPort
+ + ", Load Balance Address = " + loadBalanceAddress + ":" + loadBalancePort + ", Site-to-Site Raw Address = " + siteToSiteAddress + ":" + siteToSitePort
+ + ", Site-to-Site HTTP Address = " + apiAddress + ":" + siteToSiteHttpApiPort + ", Site-to-Site Secure = " + siteToSiteSecure + ", Node Identities = " + nodeIdentities + "]";
+ }
+
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/9dfc6683/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/node/NodeClusterCoordinator.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/node/NodeClusterCoordinator.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/node/NodeClusterCoordinator.java
index 484d155..b24475e 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/node/NodeClusterCoordinator.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/node/NodeClusterCoordinator.java
@@ -174,8 +174,8 @@ public class NodeClusterCoordinator implements ClusterCoordinator, ProtocolHandl
if (localNodeId == null) {
localNodeId = nodeId;
} else {
- logger.warn("When recovering state, determined that tgwo Node Identifiers claim to be the local Node Identifier: {} and {}. Will ignore both of these and wait until " +
- "connecting to cluster to determine which Node Identiifer is the local Node Identifier", localNodeId, nodeId);
+ logger.warn("When recovering state, determined that two Node Identifiers claim to be the local Node Identifier: {} and {}. Will ignore both of these and wait until " +
+ "connecting to cluster to determine which Node Identiifer is the local Node Identifier", localNodeId.getFullDescription(), nodeId.getFullDescription());
localNodeId = null;
}
}
@@ -1029,19 +1029,20 @@ public class NodeClusterCoordinator implements ClusterCoordinator, ProtocolHandl
if (existingStatus == null) {
// there is no node with that ID
resolvedNodeId = proposedIdentifier;
- logger.debug("No existing node with ID {}; resolved node ID is as-proposed", proposedIdentifier.getId());
+ logger.debug("No existing node with ID {}; resolved node ID is as-proposed", proposedIdentifier.getFullDescription());
onNodeAdded(resolvedNodeId, true);
} else if (existingStatus.getNodeIdentifier().logicallyEquals(proposedIdentifier)) {
// there is a node with that ID but it's the same node.
resolvedNodeId = proposedIdentifier;
- logger.debug("No existing node with ID {}; resolved node ID is as-proposed", proposedIdentifier.getId());
+ logger.debug("A node already exists with ID {} and is logically equivalent; resolved node ID is as-proposed: {}", proposedIdentifier.getId(), proposedIdentifier.getFullDescription());
} else {
// there is a node with that ID and it's a different node
resolvedNodeId = new NodeIdentifier(UUID.randomUUID().toString(), proposedIdentifier.getApiAddress(), proposedIdentifier.getApiPort(),
- proposedIdentifier.getSocketAddress(), proposedIdentifier.getSocketPort(), proposedIdentifier.getSiteToSiteAddress(),
- proposedIdentifier.getSiteToSitePort(), proposedIdentifier.getSiteToSiteHttpApiPort(), proposedIdentifier.isSiteToSiteSecure());
+ proposedIdentifier.getSocketAddress(), proposedIdentifier.getSocketPort(), proposedIdentifier.getLoadBalanceAddress(), proposedIdentifier.getLoadBalancePort(),
+ proposedIdentifier.getSiteToSiteAddress(), proposedIdentifier.getSiteToSitePort(), proposedIdentifier.getSiteToSiteHttpApiPort(), proposedIdentifier.isSiteToSiteSecure());
+
logger.debug("A node already exists with ID {}. Proposed Node Identifier was {}; existing Node Identifier is {}; Resolved Node Identifier is {}",
- proposedIdentifier.getId(), proposedIdentifier, getNodeIdentifier(proposedIdentifier.getId()), resolvedNodeId);
+ proposedIdentifier.getId(), proposedIdentifier.getFullDescription(), getNodeIdentifier(proposedIdentifier.getId()).getFullDescription(), resolvedNodeId.getFullDescription());
}
return resolvedNodeId;