Skip to content

Backport request to incorporate SQL Server Deadlock fix #1448 in spring-batch 4.3.x / spring-boot-starter-batch 2.6.x #4085

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
darkmastermindz opened this issue Mar 29, 2022 · 1 comment
Labels
status: declined Features that we don't intend to implement or Bug reports that are invalid or missing enough details

Comments

@darkmastermindz
Copy link

darkmastermindz commented Mar 29, 2022

See: #1448 and ref: @benas in #3927

Context

How has this issue affected you?
Unable to use spring batch for enterprise project for compatibility reasons as organization currently supports up to JDK11 and stable versions in compatibility.

What are you trying to accomplish?
Incorporate fix with spring batch that runs on JDK11 or lower / GA version as a minor bug fix.

What other alternatives have you considered?

  • Replacing Spring Batch all-together
  • Overwriting GA version classes

Are you aware of any workarounds?
No

@darkmastermindz darkmastermindz added status: waiting-for-triage Issues that we did not analyse yet type: feature labels Mar 29, 2022
@darkmastermindz darkmastermindz changed the title Feature request to incorpo SQL Server Deadlock fix #1448 in spring-batch 4.x / spring-boot-starter-batch 2.6.x Feature request to incorporate SQL Server Deadlock fix #1448 in spring-batch 4.x / spring-boot-starter-batch 2.6.x Mar 29, 2022
@darkmastermindz darkmastermindz changed the title Feature request to incorporate SQL Server Deadlock fix #1448 in spring-batch 4.x / spring-boot-starter-batch 2.6.x Backport request to incorporate SQL Server Deadlock fix #1448 in spring-batch 4.3.x / spring-boot-starter-batch 2.6.x Mar 30, 2022
@fmbenhassine
Copy link
Contributor

Thank you for this request. However, the fix in #1448 is a breaking change and we cannot backport it in a patch release of the v4 line.

What you can do is create the sequences and register the new incrementer (which is based on sequences) through the job repository factory bean, something like:

@Bean
public BatchConfigurer batchConfigurer(DataSource dataSource) {
	return new DefaultBatchConfigurer(dataSource) {
		@Override
		protected JobRepository createJobRepository() throws Exception {
			JobRepositoryFactoryBean factoryBean = new JobRepositoryFactoryBean();
			factoryBean.setIncrementerFactory(new DefaultDataFieldMaxValueIncrementerFactory(dataSource) {
				@Override
				public DataFieldMaxValueIncrementer getIncrementer(String incrementerType, String incrementerName) {
					return new SqlServerSequenceMaxValueIncrementer(dataSource, incrementerName);
				}
			});
			// set other properties on the factory bean
			factoryBean.afterPropertiesSet();
			return factoryBean.getObject();
		}
	};
}

This should work in a similar way to what is described here: spring-projects/spring-framework#21425 (comment).

I'm closing this issue for now, but do not hesitate to add a comment if you need further support on this.

@fmbenhassine fmbenhassine added status: declined Features that we don't intend to implement or Bug reports that are invalid or missing enough details and removed status: waiting-for-triage Issues that we did not analyse yet type: feature labels Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined Features that we don't intend to implement or Bug reports that are invalid or missing enough details
Projects
None yet
Development

No branches or pull requests

2 participants