Closed govardhanaraoganji closed 3 years ago
I have tried the below ways,
with ISOLATION_READ_COMMITTED on my job repository @transactional(isolation=Isolation.READ_COMMITTED) on my job and service. Parsing the uniqueid in job params to make my job unique(after looking into JdbcJobInstanceDao). Making my job bean as a prototype.
You did not mention if you have set hsqldb.tx=mvcc
in your connection URL as mentioned by Michael in the issue you linked. So please give that a try and let us know (here is an example). Otherwise, please provide a minimal example that reproduces the problem to be able to investigate the issue in an efficient way.
@benas, I am using embedded job repository. So do I still need to provide the hsqldb.tx=mvcc
? I assume, it will use the configuration to create a datasource(as mentioned in your example).
I don't know if hsqldb.tx=mvcc
is the default or not so I would add it explicitly in the connection string to be sure. Michael has confirmed that there is no issue when using hsqldb.tx=mvcc
with the isolation set to READ_COMMITTED
on the job repository. So I can't really validate that this is a bug in Spring Batch without reproducing the problem.
So please ask your question on StackOverflow and provide a minimal complete example. If we validate the bug, then we will re-open this issue for further investigation. Thank you.
Thank you @benas for your support. After creating DataSource(with ...hsqldb.tx=mvcc
), I got the Could not increment identity...
error, So I have changed the isolation level to ISOLATION_REPEATABLE_READ
.
I have done my final testing. I am able to trigger the job multiple times after using custom beans like DataSource(with ...hsqldb.tx=mvcc
), JobRepository(with ISOLATION_REPEATABLE_READ
) and JobLauncher.
Please consider below are the improvement,
..hsqldb.tx=mvcc
looks like is not a default, could you make it as a default configuration.@benas, I'd love to work on this feature if you gives me access for repo.
I don't see any feature to implement here. As a user, you need to add hsqldb.tx=mvcc
to the connection string of your HSQLDB configuration and set the isolation level to ISOLATION_ READ_COMMITTED
or ISOLATION_REPEATABLE_READ
in your job repository (which solved your issue as you mentioned). There is no feature to implement in Spring Batch for that.
I totally agree and it resolved my issues but embedded HSQL datasource is not using the hsqldb.tx=mvcc
(for example) and if we bring isolation levels into a configuration like spring.batch.isolation.level=ISOLATION_REPEATABLE_READ
or etc. Framework will use the configuration to create a bean.
Team, I am facing the same issue in the reference(in the below). I have a job and I want to run at the same time with different contexts. So EOD, it will fulfill a different purpose but same logic. It is working fine when I schedule job at different times and also when I run individually.
I have tried the below ways,
I am using the, spring-boot-starter-batch: 2.3.7.RELEASE spring-boot-starter-parent: 2.3.7.RELEASE hsqldb: 2.5.1
ImportScheduleConfiguration:
ImportJobProcessingService:
Ref of stack trace,
Originally posted by @govardhanaraoganji in https://github.com/spring-projects/spring-batch/issues/1230#issuecomment-838711447