From 3c49a932894514e44b2cad5a6dd4d7f7b78cb968 Mon Sep 17 00:00:00 2001 From: Mark Payne Date: Tue, 12 Jul 2016 17:23:40 -0400 Subject: [PATCH] NIFI-2234: Fixed but that was overwriting the cluster node identifier in provenance events. This closes #633 --- .../endpoints/ProvenanceQueryEndpointMerger.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ProvenanceQueryEndpointMerger.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ProvenanceQueryEndpointMerger.java index 6e0e2b5130..6838e39157 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ProvenanceQueryEndpointMerger.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ProvenanceQueryEndpointMerger.java @@ -98,10 +98,17 @@ public class ProvenanceQueryEndpointMerger implements EndpointResponseMerger { // populate the cluster identifier for (final ProvenanceEventDTO eventDto : nodeResultDto.getProvenanceEvents()) { - eventDto.setClusterNodeId(nodeIdentifier.getId()); - eventDto.setClusterNodeAddress(nodeAddress); - // add node identifier to the event's id so that it is unique across cluster - eventDto.setId(nodeIdentifier.getId() + eventDto.getId()); + // if the cluster node id or node address is not set, then we need to populate them. If they + // are already set, we don't want to populate them because it will be the case that they were populated + // by the Cluster Coordinator when it federated the request, and we are now just receiving the response + // from the Cluster Coordinator. + if (eventDto.getClusterNodeId() == null || eventDto.getClusterNodeAddress() == null) { + eventDto.setClusterNodeId(nodeIdentifier.getId()); + eventDto.setClusterNodeAddress(nodeAddress); + // add node identifier to the event's id so that it is unique across cluster + eventDto.setId(nodeIdentifier.getId() + eventDto.getId()); + } + allResults.add(eventDto); } }