You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Bryan Rosander (JIRA)" <ji...@apache.org> on 2019/04/17 22:28:00 UTC

[jira] [Updated] (NIFI-6226) WriteAheadStorePartition thinks its maxEventId is 0 if empty or malformed file w/ largest numeric name exists

     [ https://issues.apache.org/jira/browse/NIFI-6226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Rosander updated NIFI-6226:
---------------------------------
    Description: 
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]

Suggest returning -1 from EmptyRecordReader.getMaxEventId()

[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]

  was:
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]


> 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
>            Priority: Major
>
> 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]
> Suggest returning -1 from EmptyRecordReader.getMaxEventId()
> [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)