You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CompositeItemReader re-reads items on restart when a chunk spans two delegates #5591
CompositeItemReader#update only updates the current delegate. When a chunk
spans two delegates, the state of the previous delegate is not saved. As a
result, the items the previous delegate read in that chunk are read again on
restart, even though they were already committed.
Steps to reproduce
Create a CompositeItemReader with two stateful delegates: reader1
(a1, a2, a3) and reader2 (b1, b2).
Read a1, a2, then call update (end of the first chunk).
Read a3, b1, then call update (end of the second chunk, which spans reader1 and reader2).
Restart: open a new CompositeItemReader with the same ExecutionContext
and read the remaining items.
Expected behavior
At the end of the second chunk, the state of both delegates is saved, and the
restart resumes from b2.
Delegate
Items read up to the second chunk
Saved state
Items to read after restart
reader1
a1, a2, a3
3 items read (exhausted)
none
reader2
b1
1 item read
b2
Items read after restart: [b2]
Actual behavior
The restart should resume from b2, but a3 of the other delegate
(reader1) is read first. a3 was already committed in the second chunk, so
it is read twice.
Delegate
Saved state
Items read after restart
reader1
2 items read (saved only at the end of the first chunk)
Activity
Refine contribution #5593
Fix CompositeItemReader re-reading items on restart
Refine contribution #5593
Fix CompositeItemReader re-reading items on restart