Skip to content

Fix multi-threaded empty read for JdbcPagingItemReader #3959

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

Fix multi-threaded empty read for JdbcPagingItemReader #3959

wants to merge 2 commits into from

Conversation

hpoettker
Copy link
Contributor

On empty input, the JdbcPagingItemReader cannot derive a start value for the sort key to be used in further queries. For multi-threaded steps, it is thus necessary to prevent the reader from trying to read further pages if the first page is empty.

Some of the tests in spring-batch-infrastructure are quite interconnected. I amended another test and reduced naming collisions between embedded databases by using generated names until both the build from the command line and in my IDE were successful.

Fixes #3898

On empty input, the JdbcPagingItemReader cannot derive a start value for the sort key to be used in further queries. For multi-threaded steps, it is thus necessary to prevent the reader from trying to read further pages if the first page is empty.

Issue #3898
@fmbenhassine fmbenhassine added this to the 4.3.4 milestone Aug 9, 2021
@fmbenhassine fmbenhassine added the for: backport-to-4.2.x Issues that will be back-ported to the 4.2.x line label Aug 9, 2021
Conflicts:
	spring-batch-infrastructure/src/test/resources/org/springframework/batch/item/database/JdbcPagingItemReaderCommonTests-context.xml
	spring-batch-infrastructure/src/test/resources/org/springframework/batch/item/database/JpaPagingItemReaderCommonTests-context.xml
	spring-batch-infrastructure/src/test/resources/org/springframework/batch/item/database/data-source-context.xml
@fmbenhassine
Copy link
Contributor

LGTM. Rebased and merged as 78ddf44. Thank you for your contribution!

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

Successfully merging this pull request may close these issues.

JdbcPagingItemReader with sort key crashes in multithreaded step for empty query
2 participants