nifi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pvill...@apache.org
Subject nifi git commit: NIFI-4045: - Addressing issues causing the eventId to not be relayed when submitting a lineage request under certain conditions.
Date Tue, 27 Jun 2017 19:49:04 GMT
Repository: nifi
Updated Branches:
  refs/heads/master 1e7eceee8 -> c99c036c2


NIFI-4045:
- Addressing issues causing the eventId to not be relayed when submitting a lineage request
under certain conditions.

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes #1903.


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/c99c036c
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/c99c036c
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/c99c036c

Branch: refs/heads/master
Commit: c99c036c207d6e434295bb1200dbcffacdffd128
Parents: 1e7ecee
Author: Matt Gilman <matt.c.gilman@gmail.com>
Authored: Thu Jun 8 13:38:19 2017 -0400
Committer: Pierre Villard <pierre.villard.fr@gmail.com>
Committed: Tue Jun 27 21:48:55 2017 +0200

----------------------------------------------------------------------
 .../lineage/ComputeLineageSubmission.java       | 15 +++++--
 .../provenance/lineage/LineageRequestDTO.java   |  5 ++-
 .../apache/nifi/web/api/ProvenanceResource.java |  2 +-
 .../org/apache/nifi/web/api/dto/DtoFactory.java |  1 +
 .../nifi/web/controller/ControllerFacade.java   |  6 +--
 .../VolatileProvenanceRepository.java           | 41 ++++++++++----------
 6 files changed, 41 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/c99c036c/nifi-framework-api/src/main/java/org/apache/nifi/provenance/lineage/ComputeLineageSubmission.java
----------------------------------------------------------------------
diff --git a/nifi-framework-api/src/main/java/org/apache/nifi/provenance/lineage/ComputeLineageSubmission.java
b/nifi-framework-api/src/main/java/org/apache/nifi/provenance/lineage/ComputeLineageSubmission.java
index 8a11523..773f9ae 100644
--- a/nifi-framework-api/src/main/java/org/apache/nifi/provenance/lineage/ComputeLineageSubmission.java
+++ b/nifi-framework-api/src/main/java/org/apache/nifi/provenance/lineage/ComputeLineageSubmission.java
@@ -60,10 +60,19 @@ public interface ComputeLineageSubmission {
     LineageComputationType getLineageComputationType();
 
     /**
-     * @return If the Lineage Computation Type of this submission is
+     * If the Lineage Computation Type of this submission is
      * {@link LineageComputationType.EXPAND_CHILDREN} or
-     * {@link LineageComputationType.EXPAND_PARENTS}, indicates the ID event
-     * that is to be expanded; otherwise, returns <code>null</code>
+     * {@link LineageComputationType.EXPAND_PARENTS}, indicates
+     * the event ID that is to be expanded.
+     *
+     * If the Lineage Computation Type of this submission is
+     * {@link LineageComputationType.FLOWFILE_LINEAGE} and the
+     * original submission was based off an event id, indicates
+     * that event ID.
+     *
+     * Otherwise returns <code>null</code>.
+     *
+     * @return the event id if applicable
      */
     Long getExpandedEventId();
 

http://git-wip-us.apache.org/repos/asf/nifi/blob/c99c036c/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageRequestDTO.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageRequestDTO.java
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageRequestDTO.java
index 5a59a7c..5473efd 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageRequestDTO.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageRequestDTO.java
@@ -47,7 +47,8 @@ public class LineageRequestDTO {
      * @return event id that was used to generate this lineage
      */
     @ApiModelProperty(
-            value = ""
+            value = "The event id that was used to generate this lineage, if applicable.
The event id is allowed for any type of lineageRequestType. If the lineageRequestType is FLOWFILE
and the "
+                    + "flowfile uuid is also included in the request, the event id will be
ignored."
     )
     public Long getEventId() {
         return eventId;
@@ -90,7 +91,7 @@ public class LineageRequestDTO {
      * @return uuid that was used to generate this lineage
      */
     @ApiModelProperty(
-            value = "The uuid that was used to generate the lineage."
+            value = "The flowfile uuid that was used to generate the lineage. The flowfile
uuid is only allowed when the lineageRequestType is FLOWFILE and will take precedence over
event id."
     )
     public String getUuid() {
         return uuid;

http://git-wip-us.apache.org/repos/asf/nifi/blob/c99c036c/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProvenanceResource.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProvenanceResource.java
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProvenanceResource.java
index e5b6cc2..c17ad85 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProvenanceResource.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProvenanceResource.java
@@ -485,7 +485,7 @@ public class ProvenanceResource extends ApplicationResource {
                 }
                 break;
             case FLOWFILE:
-                // ensure the uuid has been specified
+                // ensure the uuid or event id has been specified
                 if (requestDto.getUuid() == null && requestDto.getEventId() == null)
{
                     throw new IllegalArgumentException("The flowfile uuid or event id must
be specified when the event type is FLOWFILE.");
                 }

http://git-wip-us.apache.org/repos/asf/nifi/blob/c99c036c/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java
index 4b59de9..74123b0 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java
@@ -2432,6 +2432,7 @@ public final class DtoFactory {
                 if (uuids.size() == 1) {
                     requestDto.setUuid(uuids.iterator().next());
                 }
+                requestDto.setEventId(computeLineageSubmission.getExpandedEventId());
                 requestDto.setLineageRequestType(LineageRequestType.FLOWFILE);
                 break;
         }

http://git-wip-us.apache.org/repos/asf/nifi/blob/c99c036c/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/controller/ControllerFacade.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/controller/ControllerFacade.java
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/controller/ControllerFacade.java
index 527a994..420022f 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/controller/ControllerFacade.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/controller/ControllerFacade.java
@@ -1105,12 +1105,12 @@ public class ControllerFacade implements Authorizable {
         final ProvenanceRepository provenanceRepository = flowController.getProvenanceRepository();
         final ComputeLineageSubmission result;
 
-        // submit the event
         if (LineageRequestType.FLOWFILE.equals(requestDto.getLineageRequestType())) {
-            // submit uuid
-            if (requestDto.getEventId() == null) {
+            if (requestDto.getUuid() != null) {
+                // submit uuid if it is specified
                 result = provenanceRepository.submitLineageComputation(requestDto.getUuid(),
NiFiUserUtils.getNiFiUser());
             } else {
+                // submit the event if the flowfile uuid needs to be looked up
                 result = provenanceRepository.submitLineageComputation(requestDto.getEventId(),
NiFiUserUtils.getNiFiUser());
             }
         } else {

http://git-wip-us.apache.org/repos/asf/nifi/blob/c99c036c/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-volatile-provenance-repository/src/main/java/org/apache/nifi/provenance/VolatileProvenanceRepository.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-volatile-provenance-repository/src/main/java/org/apache/nifi/provenance/VolatileProvenanceRepository.java
b/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-volatile-provenance-repository/src/main/java/org/apache/nifi/provenance/VolatileProvenanceRepository.java
index c3fbf42..c8511be 100644
--- a/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-volatile-provenance-repository/src/main/java/org/apache/nifi/provenance/VolatileProvenanceRepository.java
+++ b/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-volatile-provenance-repository/src/main/java/org/apache/nifi/provenance/VolatileProvenanceRepository.java
@@ -16,25 +16,6 @@
  */
 package org.apache.nifi.provenance;
 
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.regex.Pattern;
 import org.apache.nifi.authorization.AccessDeniedException;
 import org.apache.nifi.authorization.AuthorizationResult;
 import org.apache.nifi.authorization.AuthorizationResult.Result;
@@ -61,6 +42,26 @@ import org.apache.nifi.util.RingBuffer.ForEachEvaluator;
 import org.apache.nifi.util.RingBuffer.IterationDirection;
 import org.apache.nifi.web.ResourceNotFoundException;
 
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.regex.Pattern;
+
 public class VolatileProvenanceRepository implements ProvenanceRepository {
 
     // properties
@@ -502,7 +503,7 @@ public class VolatileProvenanceRepository implements ProvenanceRepository
{
             return result;
         }
 
-        return submitLineageComputation(event.getFlowFileUuid(), user);
+        return submitLineageComputation(Collections.singleton(event.getFlowFileUuid()), user,
LineageComputationType.FLOWFILE_LINEAGE, eventId);
     }
 
     @Override


Mime
View raw message