-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Missing instruction about accessing historical data in the migration guide #4352
Comments
Thank you for raising this. v4 and v5 are not compatible, and once the migration is done, historical data of v4 should not be accessed with v5 (which is what your sample is doing). The only case I see is restarting a failed job instance that was started with v4, and then attempted again with v5, but this should not be done. We might need to clarify this in the migration guide, but users should ensure all failed v4 job instances are either restarted to success or abandoned before the migration. Does this clarify your concern? |
Hi @fmbenhassine , Just I would highlight that restarting a failed job is not the only scenario in which "historical data" is accessed. explorer.findJobInstancesByJobName("test", 0, 10)
.stream()
.map(explorer::getJobExecutions)
.flatMap(Collection::stream)
.count(); What I mean is that there are APIs (like JobExplorer) that allows to navigate the data and those functionalities will be prevented by this breaking change. Hoping to help you in the analysis let me share a bit about our scenario. So we define a job: EXTRACTION that expects two parameters: FROM and TO. First run: Second run: I don't know if how we're handle this scenario is a best practice but my aim was to share a scenario in which this issues impacts but it's not relate to restarting a failed job. |
By Apologies for the confusion, but we definitely need to add this in the migration guide. In your time-based sample, you should calculate the last delta using v4, and once that done, you can migrate to v5 so that the next range is exclusively v5. I don't think there is anything we can do here for the code, so I am going to turn this into a documentation issue and update the migration guide accordingly. |
Clear! Thank you for your support and the clarification! |
I updated the migration guide with a new section about the implications of the change related to job parameters handling on historical meta-data access: Thanks again for raising this! |
Bug description
Scenario: We're upgrading out solution from Spring boot 2.7.x to 3.0.x passing so from Spring Batch: 4.3.x to 5.0.1
That means that our current application is already in production and it leverage in a JobRepository that is on an Oracle Database and it's filled by job executed in the past on top of version 4.3.x
Upgrading to version 5.0.1 we're now facing this exception while trying to access to job parameters' stored in the repository by v. 4.3.x :
I'm digging a bit into it in order to collect more details.
Right now what I can share is that this is the code that throws the exception:
And I think that it's due to the fact that:
rs.getString("PARAMETER_TYPE")
will return STRING if the record in BATCH_JOB_EXECUTION_PARAMS was add by a version <5.x.x. Instead if the record is add by a version >= 5.x.x this will work because on the DB the PARAMETER_TYPE will be: java.lang.String(right now we're facing this issue only for STRING but if this supposition is confirmed other types: DATE, LONG, will face the same issue I guess)
Environment
Spring Batch version: from 4.3.x to 5.0.1
Java version: 17
Oracle 19 and Oracle 21
Steps to reproduce
Expected behavior
Library should be able to access the data stored in a long-term repository by and older version
Minimal Complete Reproducible example
Unzip file: spring-batch-4352-mre.zip
Execute job with Spring batch 4.3.x:
cd batch-processing4.3.x/batch-processing ; ./gradlew clean bootRun
Execute job with Spring batch 5.0.x:
cd ../../batch-processing5.0.x/batch-processing ; ./gradlew clean bootRun
This step at point 3. will fail due to: java.lang.ClassNotFoundException: STRING
The text was updated successfully, but these errors were encountered: