pvillard31 opened a new pull request, #11450:
URL: https://github.com/apache/nifi/pull/11450

   ## Summary
   
   Provenance event IDs are local counters per node, starting at 0 and 
incrementing independently. In a multi-node cluster two different nodes can 
legitimately have the same numeric event ID for entirely different physical 
provenance events.
   
   `ReplayLastEventEndpointMerger` was using a `HashSet<Long>` to accumulate 
event IDs returned by each node after a "replay last event" request. Because 
both nodes in a 2-node cluster where each has processed the same number of 
events will return the same local event ID, the `HashSet` silently deduplicated 
them and reported `eventsReplayed.size() == 1` instead of `2`. This caused 
`ClusteredReplayProvenanceIT.testReplayLastEvent` (with `ReplayEventNodes.ALL`) 
to fail with `expected: <2> but was: <1>`.
   
   **Change:** Replace `HashSet<Long>` with `ArrayList<Long>` for the event ID 
accumulator so each node's replay is counted independently regardless of 
matching local event IDs.
   
   **Also adds:** `ReplayLastEventEndpointMergerTest` — there was no unit test 
for this merger class. The test covers the colliding-ID case (regression test 
for this fix), the distinct-ID case, and the partial-failure case.
   
   ## Test plan
   
   - [ ] New unit test `ReplayLastEventEndpointMergerTest` (4 test cases): all 
pass locally
   - [ ] 
`ClusteredReplayProvenanceIT.testReplayLastEvent(ReplayEventNodes.ALL)` should 
pass reliably in CI with this fix


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to