Skip to content

NIFI-16098 Prevent content-claim truncation from dropping content referenced by a live sibling FlowFile#11414

Open
pvillard31 wants to merge 2 commits into
apache:mainfrom
pvillard31:NIFI-16098
Open

NIFI-16098 Prevent content-claim truncation from dropping content referenced by a live sibling FlowFile#11414
pvillard31 wants to merge 2 commits into
apache:mainfrom
pvillard31:NIFI-16098

Conversation

@pvillard31

Copy link
Copy Markdown
Contributor

Summary

NIFI-16098 Prevent content-claim truncation from dropping content referenced by a live sibling FlowFile

A FlowFile created and removed within a single session (e.g. ExecuteGroovyScript with Failure Strategy 'transfer to failure', which clones on get and removes the clone at commit) yields one repository record whose type transitions CREATE->DELETE. The truncation reference count is incremented only for a committed CREATE, so that increment never ran, but the DELETE still decremented it. For a content claim shared with a live sibling FlowFile this drove the truncation reference count to zero, allowing the claim to be truncated and the sibling's content to be lost.

Only decrement the truncation reference count on delete of a persisted FlowFile (one that has an original claim).

Tracking

Please complete the following tracking steps prior to pull request creation.

Issue Tracking

Pull Request Tracking

  • Pull Request title starts with Apache NiFi Jira issue number, such as NIFI-00000
  • Pull Request commit message starts with Apache NiFi Jira issue number, as such NIFI-00000
  • Pull request contains commits signed with a registered key indicating Verified status

Pull Request Formatting

  • Pull Request based on current revision of the main branch
  • Pull Request refers to a feature branch with one commit containing changes

Verification

Please indicate the verification steps performed prior to pull request creation.

Build

  • Build completed using ./mvnw clean install -P contrib-check
    • JDK 21
    • JDK 25

Licensing

  • New dependencies are compatible with the Apache License 2.0 according to the License Policy
  • New dependencies are documented in applicable LICENSE and NOTICE files

Documentation

  • Documentation formatting appears as expected in rendered files

…erenced by a live sibling FlowFile

A FlowFile created and removed within a single session (e.g. ExecuteGroovyScript
with Failure Strategy 'transfer to failure', which clones on get and removes the
clone at commit) yields one repository record whose type transitions CREATE->DELETE.
The truncation reference count is incremented only for a committed CREATE, so that
increment never ran, but the DELETE still decremented it. For a content claim shared
with a live sibling FlowFile this drove the truncation reference count to zero,
allowing the claim to be truncated and the sibling's content to be lost.

Only decrement the truncation reference count on delete of a persisted FlowFile
(one that has an original claim).
@pvillard31
pvillard31 requested a review from markap14 July 10, 2026 10:45
@pvillard31 pvillard31 added the bug label Jul 10, 2026
…with an in-session cloned FlowFile

Adds a CloneAndTerminate test processor that, for each incoming FlowFile, clones it and removes both the
clone and the input within the same session (the record set produced by ExecuteGroovyScript with Failure
Strategy 'transfer to failure'). A new ContentClaimTruncationIT case forks a generator to this processor
and to a leg that holds the FlowFiles, and verifies the shared content claims are not truncated while the
holding leg still references them. The test fails without the accompanying framework fix (content is
truncated away) and passes with it.
@pkelly-nifi

Copy link
Copy Markdown
Contributor

Thanks for fixing this so quickly, @pvillard31. I just built a copy of NiFi 2.10.0 incorporating your changes and it seems to be working correctly now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants