nifi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF subversion and git services (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (NIFI-2159) Fingerprint not detecting flow.xml differences
Date Wed, 06 Jul 2016 21:13:11 GMT

    [ https://issues.apache.org/jira/browse/NIFI-2159?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15365099#comment-15365099
] 

ASF subversion and git services commented on NIFI-2159:
-------------------------------------------------------

Commit 4f2d17a8d4a8a674cd22bf9df68f9d64bff93b92 in nifi's branch refs/heads/master from [~markap14]
[ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=4f2d17a ]

NIFI-2159: Fixed bug that caused relationship names not to get added to fingerprint

This closes #612

Signed-off-by: jpercivall <joepercivall@yahoo.com>


> Fingerprint not detecting flow.xml differences
> ----------------------------------------------
>
>                 Key: NIFI-2159
>                 URL: https://issues.apache.org/jira/browse/NIFI-2159
>             Project: Apache NiFi
>          Issue Type: Bug
>    Affects Versions: 0.6.1
>            Reporter: Brandon DeVries
>            Assignee: Mark Payne
>            Priority: Blocker
>             Fix For: 1.0.0, 0.7.0
>
>
> We have very occasionally observed situations where the flow.xml across a cluster was
able to become inconsistent, resulting in unexpected behavior.  While investigating, the following
issue was found.  While we are not 100% that this problem is the one we were looking for,
it is definitely an issue...
> Within the FingerprintFactory, the text values from <relationship> tags were always
being appended to the fingerprint as a default value of "NO_VALUE" regardless of whether or
not they actually contained a value.  This can manifest as two different flow.xml files being
considered the same when they have the same number of relationship tags, even though those
tags contain different values.  Here is a suggested fix:
> Change the following in FingerprintFactory.java\[1\]:
> {code}
> final List<Element> sortedRelationshipElems = sortElements(relationshipElems, getConnectionRelationshipsComparator());
> for (final Element relationshipElem : sortedRelationshipElems) {
>         addConnectionRelationshipFingerprint(builder, relationshipElem);
> }
> {code}
> To:
> {code}
> for (int i = 0;i<relationshipElems.getLength();i++) {
>        builder.append(getValue(relationshipElems.item(i),"NO_VALUE"));
> }
> {code}
> The following unit test will show that the value of the relationship is now being used
in the fingerprint:
> {code}
> @Test
> public void testResourceValueInFingerprint() throws IOException{
>        final String fp1 = fingerprinter.createFingerprint(getResourceBytes("/nifi/fingerprint/flow1a.xml"),null);
>        assertEquals(3,StringUtils.countMatches(fp1,"success"));
> }
> {code}
> Additionally, the <name> tag isn't being included in the fingerprint either.  While
the following solution has not been tested, it is possible that this could be fixed by adding
the following line to the addConnectionFingerprint() method \[2\]:
> {code}
> appendFirstValue(builder, DomUtils.getChildNodesByTagName(connectionElem, "name"));
> {code}
> \[1\] https://github.com/apache/nifi/blob/270944ec692e12c221cdff202bdab56309dfcfd7/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/fingerprint/FingerprintFactory.java#L861-864
> \[2\] https://github.com/apache/nifi/blob/270944ec692e12c221cdff202bdab56309dfcfd7/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/fingerprint/FingerprintFactory.java#L857



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message