From 2d70bfb3804c508a0972695407e4e3e6ba22fbcc Mon Sep 17 00:00:00 2001 From: sopan98 Date: Mon, 21 Nov 2022 23:30:31 -0500 Subject: [PATCH] NIFI-10744 Changed HashSet to LinkedHashSet in SegmentContent for deterministic handling This closes #6700 Signed-off-by: David Handermann --- .../org/apache/nifi/processors/standard/SegmentContent.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/SegmentContent.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/SegmentContent.java index 1fc1feb69a..d29bff812d 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/SegmentContent.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/SegmentContent.java @@ -20,6 +20,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -170,7 +171,7 @@ public class SegmentContent extends AbstractProcessor { segmentAttributes.put(FRAGMENT_ID, segmentId); segmentAttributes.put(FRAGMENT_COUNT, String.valueOf(totalSegments)); - final Set segmentSet = new HashSet<>(); + final Set segmentSet = new LinkedHashSet<>(); for (int i = 1; i <= totalSegments; i++) { final long segmentOffset = segmentSize * (i - 1); FlowFile segment = session.clone(flowFile, segmentOffset, Math.min(segmentSize, flowFile.getSize() - segmentOffset));