Github user trkurc commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/123#discussion_r44872922
  
    --- Diff: 
nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/lucene/DocsReader.java
 ---
    @@ -100,101 +96,61 @@ private ProvenanceEventRecord getRecord(final 
Document d, final RecordReader rea
                 }
             }
     
    -        if ( record == null ) {
    -            throw new IOException("Failed to find Provenance Event " + d);
    -        } else {
    -            return record;
    +        if (record == null) {
    +            logger.warn("Failed to read Provenance Event for '" + d + "'. 
The event file may be missing or corrupted");
             }
    -    }
     
    +        return record;
    +    }
     
         public Set<ProvenanceEventRecord> read(final List<Document> docs, 
final Collection<Path> allProvenanceLogFiles,
    -        final AtomicInteger retrievalCount, final int maxResults, final 
int maxAttributeChars) throws IOException {
    -        if (retrievalCount.get() >= maxResults) {
    -            return Collections.emptySet();
    -        }
    -
    -        LuceneUtil.sortDocsForRetrieval(docs);
    -
    -        RecordReader reader = null;
    -        String lastStorageFilename = null;
    -        final Set<ProvenanceEventRecord> matchingRecords = new 
LinkedHashSet<>();
    +            final AtomicInteger retrievalCount, final int maxResults, 
final int maxAttributeChars) throws IOException {
     
             final long start = System.nanoTime();
    -        int logFileCount = 0;
    -
    -        final Set<String> storageFilesToSkip = new HashSet<>();
    -        int eventsReadThisFile = 0;
     
    -        try {
    -            for (final Document d : docs) {
    -                final String storageFilename = 
d.getField(FieldNames.STORAGE_FILENAME).stringValue();
    -                if ( storageFilesToSkip.contains(storageFilename) ) {
    -                    continue;
    -                }
    -
    -                try {
    -                    if (reader != null && 
storageFilename.equals(lastStorageFilename)) {
    -                        matchingRecords.add(getRecord(d, reader));
    -                        eventsReadThisFile++;
    -
    -                        if ( retrievalCount.incrementAndGet() >= 
maxResults ) {
    -                            break;
    -                        }
    -                    } else {
    -                        logger.debug("Opening log file {}", 
storageFilename);
    -
    -                        logFileCount++;
    -                        if (reader != null) {
    -                            reader.close();
    -                        }
    +        Set<ProvenanceEventRecord> matchingRecords = new LinkedHashSet<>();
    +        if (retrievalCount.get() >= maxResults) {
    +            return matchingRecords;
    --- End diff --
    
    @joewitt - if this causes GC problems we've got other _major_ issues. I was 
just bit surprised a change was made that in my opinion was marginally and 
subjectively a step backwards.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to