You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2022/10/12 11:54:15 UTC

[GitHub] [nifi] exceptionfactory commented on a diff in pull request #6507: NIFI-10622 Fix Flaky Test

exceptionfactory commented on code in PR #6507:
URL: https://github.com/apache/nifi/pull/6507#discussion_r993352966


##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/protocol/AbstractFlowFileServerProtocol.java:
##########
@@ -257,7 +259,13 @@ public int transferFlowFiles(final Peer peer, final ProcessContext context, fina
             session.read(flowFile, new InputStreamCallback() {
                 @Override
                 public void process(final InputStream in) throws IOException {
-                    final DataPacket dataPacket = new StandardDataPacket(toSend.getAttributes(), in, toSend.getSize());
+                    LinkedHashMap<String, String> attributes = new LinkedHashMap<>();
+                    String[] keySet = toSend.getAttributes().keySet().toArray(new String[0]);
+                    Arrays.sort(keySet);
+                    for(String key: keySet){
+                        attributes.put(key, toSend.getAttributes().get(key));
+                    }

Review Comment:
   This approach effectively makes an additional copy of the attributes prior to transmission, which introduces some inefficiency when sending packets. It would be better to evaluate the initial attribute storage in the FlowFile implementation, as opposed to making this change.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org