Bryan Rosander created NIFI-6226:
------------------------------------

             Summary: WriteAheadStorePartition thinks its maxEventId is 0 if 
empty or malformed file w/ largest numeric name exists
                 Key: NIFI-6226
                 URL: https://issues.apache.org/jira/browse/NIFI-6226
             Project: Apache NiFi
          Issue Type: Bug
          Components: Core Framework
    Affects Versions: 1.8.0
            Reporter: Bryan Rosander


An EmptyRecordReader is returned when an EOF is encountered while reading the 
serialization name. [1]  EmptyRecordReader.getMaxEventId() returns 0 [2] which 
violates the RecordReader contract which specifies a -1 return when the reader 
has no records. [3]

This causes WriteAheadStorePartition to choose the file and its value (0) as 
the maximum event id, causing mass reindexing and potential id reuse. [4]

[1] 
[https://github.com/apache/nifi/blob/8411b6a46f5a2bf83eb3899cca3374bd863da1a0/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/serialization/RecordReaders.java#L134]

[2] 
[https://github.com/apache/nifi/blob/8411b6a46f5a2bf83eb3899cca3374bd863da1a0/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/serialization/EmptyRecordReader.java#L72]

[3] 
[https://github.com/apache/nifi/blob/8411b6a46f5a2bf83eb3899cca3374bd863da1a0/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/serialization/RecordReader.java#L112]

[4] 
[https://github.com/apache/nifi/blob/8411b6a46f5a2bf83eb3899cca3374bd863da1a0/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/store/WriteAheadStorePartition.java#L127]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to