@Override public int compare(final StandardProvenanceEventRecord o1, final StandardProvenanceEventRecord o2) { return Long.compare(o1.getEventId(), o2.getEventId()); } });
protected Optional<StandardProvenanceEventRecord> readToEvent(final long eventId, final DataInputStream dis, final int serializationVerison) throws IOException { StandardProvenanceEventRecord event; while ((event = nextRecord()) != null) { if (event.getEventId() >= eventId) { return Optional.of(event); } } return Optional.empty(); }
/** * Returns a unique identifier for the record. By default, it uses * {@link ProvenanceEventRecord#getEventId()} but if it has not been persisted to the * repository, this is {@code -1}, so it constructs a String of the format * {@code <event type>_on_<flowfile UUID>_by_<component UUID>_at_<event time>}. * * @return a String identifying the record for later analysis */ @Override public String getBestEventIdentifier() { if (getEventId() != -1) { return Long.toString(getEventId()); } else { return getEventType().name() + "_on_" + getFlowFileUuid() + "_by_" + getComponentId() + "_at_" + getEventTime(); } }
if (pushbackEvent != null) { final StandardProvenanceEventRecord previousPushBack = pushbackEvent; if (previousPushBack.getEventId() >= eventId) { return Optional.of(previousPushBack); } else {
if (eventId > 0L && other.getEventId() > 0L && eventId != other.getEventId()) { return false;
if (record.getEventId() >= firstRecordId && isAuthorized(record, user)) { records.add(record);
} else { final long eventSize = recordReader.getBytesConsumed() - startBytesConsumed; storageMap.put(event, new StorageSummary(event.getEventId(), eventFile.getName(), partitionName, recordReader.getBlockIndex(), eventSize, 0L));
private ProvenanceEventRecord getRecord(final Document d, final RecordReader reader) throws IOException { final IndexableField blockField = d.getField(FieldNames.BLOCK_INDEX); if ( blockField == null ) { reader.skipTo(getByteOffset(d, reader)); } else { reader.skipToBlock(blockField.numericValue().intValue()); } StandardProvenanceEventRecord record; while ( (record = reader.nextRecord()) != null) { final IndexableField idField = d.getField(SearchableFields.Identifier.getSearchableFieldName()); if ( idField == null || idField.numericValue().longValue() == record.getEventId() ) { break; } } if (record == null) { logger.warn("Failed to read Provenance Event for '" + d + "'. The event file may be missing or corrupted"); } return record; }
if (record.getEventId() < minEventId) { minEventId = record.getEventId(); maxId = record.getEventId();
private StandardProvenanceEventRecord truncateAttributes(final StandardProvenanceEventRecord original) { boolean requireTruncation = false; for (final String updatedAttr : original.getUpdatedAttributes().values()) { if (updatedAttr != null && updatedAttr.length() > maxAttributeChars) { requireTruncation = true; break; } } if (!requireTruncation) { for (final String previousAttr : original.getPreviousAttributes().values()) { if (previousAttr != null && previousAttr.length() > maxAttributeChars) { requireTruncation = true; break; } } } if (!requireTruncation) { return original; } final StandardProvenanceEventRecord.Builder builder = new StandardProvenanceEventRecord.Builder().fromEvent(original); builder.setAttributes(truncateAttributes(original.getPreviousAttributes()), truncateAttributes(original.getUpdatedAttributes())); final StandardProvenanceEventRecord truncated = builder.build(); truncated.setEventId(original.getEventId()); return truncated; }
} else { doc.add(new IntField(FieldNames.BLOCK_INDEX, blockIndex, Store.YES)); doc.add(new LongField(SearchableFields.Identifier.getSearchableFieldName(), record.getEventId(), Store.YES));
@Override public int compare(final StandardProvenanceEventRecord o1, final StandardProvenanceEventRecord o2) { return Long.compare(o1.getEventId(), o2.getEventId()); } });
/** * Returns a unique identifier for the record. By default, it uses * {@link ProvenanceEventRecord#getEventId()} but if it has not been persisted to the * repository, this is {@code -1}, so it constructs a String of the format * {@code <event type>_on_<flowfile UUID>_by_<component UUID>_at_<event time>}. * * @return a String identifying the record for later analysis */ @Override public String getBestEventIdentifier() { if (getEventId() != -1) { return Long.toString(getEventId()); } else { return getEventType().name() + "_on_" + getFlowFileUuid() + "_by_" + getComponentId() + "_at_" + getEventTime(); } }
if (eventId > 0L && other.getEventId() > 0L && eventId != other.getEventId()) { return false;
if (record.getEventId() >= firstRecordId && isAuthorized(record, user)) { records.add(record);
if (record.getEventId() < minEventId) { minEventId = record.getEventId(); maxId = record.getEventId();
private StandardProvenanceEventRecord truncateAttributes(final StandardProvenanceEventRecord original) { boolean requireTruncation = false; for (final String updatedAttr : original.getUpdatedAttributes().values()) { if (updatedAttr != null && updatedAttr.length() > maxAttributeChars) { requireTruncation = true; break; } } if (!requireTruncation) { for (final String previousAttr : original.getPreviousAttributes().values()) { if (previousAttr != null && previousAttr.length() > maxAttributeChars) { requireTruncation = true; break; } } } if (!requireTruncation) { return original; } final StandardProvenanceEventRecord.Builder builder = new StandardProvenanceEventRecord.Builder().fromEvent(original); builder.setAttributes(truncateAttributes(original.getPreviousAttributes()), truncateAttributes(original.getUpdatedAttributes())); final StandardProvenanceEventRecord truncated = builder.build(); truncated.setEventId(original.getEventId()); return truncated; }