Skip to content

Commit

Permalink
NIFI-10235 Set Replay ContentClaim Length based on Content Repository
Browse files Browse the repository at this point in the history
- Changed Replay ContentClaim Length from previous file size to Content Repository size returned for ResourceClaim
- Corrected Replay handling for Encrypted Repositories since the ContentClaim Length is larger than the File Size when encrypted
  • Loading branch information
exceptionfactory committed Jul 20, 2022
1 parent ad78117 commit 1d6debd
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2891,12 +2891,15 @@ public ProvenanceEventRecord replayFlowFile(final ProvenanceEventRecord event, f
resourceClaimManager.incrementClaimantCount(resourceClaim);
final long claimOffset = event.getPreviousContentClaimOffset() == null ? 0L : event.getPreviousContentClaimOffset();
contentClaim = new StandardContentClaim(resourceClaim, claimOffset);
contentClaim.setLength(event.getPreviousFileSize() == null ? -1L : event.getPreviousFileSize());

if (!contentRepository.isAccessible(contentClaim)) {
resourceClaimManager.decrementClaimantCount(resourceClaim);
throw new IllegalStateException("Cannot replay data from Provenance Event because the data is no longer available in the Content Repository");
}

// Determine ContentClaim length according to Repository ResourceClaim
final long contentClaimLength = contentRepository.size(resourceClaim);
contentClaim.setLength(contentClaimLength);
}

final String parentUUID = event.getFlowFileUuid();
Expand Down

0 comments on commit 1d6debd

Please sign in to comment.