You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2019/04/23 17:16:00 UTC
[jira] [Commented] (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:comment-tabpanel&focusedCommentId=16824341#comment-16824341 ]
ASF subversion and git services commented on NIFI-6226:
-------------------------------------------------------
Commit d429470cc19b0a604f394cbd7181e8bf79e8fb7b in nifi's branch refs/heads/master from Bryan Rosander
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=d429470 ]
NIFI-6226: Returning -1 for EmptyRecordReader.getMaxEventId() to prevent potential provenance repo corruption
This closes #3443.
Signed-off-by: Mark Payne <ma...@hotmail.com>
> 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
> Time Spent: 10m
> Remaining Estimate: 0h
>
> 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()
>
> Here's an example log entry when this issue manifests:
> {code:java}
> 2019-04-17 20:30:20,153 INFO [pool-16-thread-1] o.a.n.p.store.WriteAheadStorePartition The last Provenance Event indexed for partition default is 53491, but the last event written to partition has ID 0. Re-indexing up to the last -53491 events to ensure that the Event Index is accurate and up-to-date
> {code}
>
> Repro:
> # Run NiFi to generate some provenance w/ write ahead repo
> # Shutdown NiFi
> # Create empty file in provenance dir w/ highest numeric value
> # Start NiFi
> This has happened in real deploys where NiFi was killed before it could shutdown properly.
>
> [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)