Skip to content

Do not advance the paging reader count when a page query fails - #5649

Open
beyondwin wants to merge 1 commit into
spring-projects:mainfrom
beyondwin:paging-read-count
Open

beyondwin wants to merge 1 commit into
spring-projects:mainfrom
beyondwin:paging-read-count

Conversation

@beyondwin

Copy link
Copy Markdown
Contributor

A fault-tolerant chunk step that retries a failed page query and commits that chunk saves a read.count that includes the failed attempt, so a restart resumes at the wrong item. On 6.0.6 and 6.1.0-RC1, a query timeout on the second page makes the JdbcPagingItemReader restart rewrite committed rows or lose one, and the job completes. RepositoryItemReader and PageableItemReader lose one when the failure does not roll back the chunk. Since #5628 JpaPagingItemReader does too.

read() counts the call before doRead(), which suits readers that consume input before failing, but a failed query leaves the page cursor in place. The paging readers now drop it. A value already saved is not corrected.

Resolves #5648

A fault-tolerant chunk step retries a failed page query and then
commits that chunk. read() counts the attempt before doRead() returns,
while the paging readers leave the page cursor unmoved, so the saved
read.count is one ahead of the items actually returned. Restart then
skips the next item or rewrites committed JDBC rows and completes, or
runs the next JDBC page with an unbound sort-key parameter.

The failed query did not consume an item, so that attempt is removed
from the count. The page is still read again on the next call. A
checkpoint that was already stored is left as it is.

Resolves spring-projects#5648

Signed-off-by: WooSeung Kim <wooseung.dev@gmail.com>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Restart after a retried page query resumes at the wrong item

1 participant