Comments (4)
I think the reason is, in the readItem
method: https://github.com/jberet/jsr352/blob/master/jberet-support/src/main/java/org/jberet/support/io/JdbcItemReader.java#L242
we can resultSet.next()
, which moves the cursor forward by one, so checkpoint - 1
is to compensate that forward move.
For instance, if we read the first item, process it, but failed in writer, hence rollback. The reader checkpoint info is now 1. When restarting, we set reposition the resultSet to checkpoint - 1
, which is 0. Then in readItem
method, calling resultSet.next()
will position it to the first item, and the subsequent resultSet.getObject()
will return the first item in the resultSet
.
Have you seen any actual unexpected behavior in restarting in your app? Any reproducible app will be even better for pinpointing the problem.
from jsr352.
I think the point is, that it's not the current row that gets persisted as a checkpoint in your example, because the transaction gets rolled back. So the checkpoint will be the index of the last item that was successfully processed and committed depending on your chunk size.
I experienced unexpected behavior in the following szenario: Suppose you process 20 elements with a chunk size of 10. So for every 10 elements, the current row is used as a checkpoint and the entire chunk is passed to the writer. If processing of element 11 leads to an error, the last checkpoint is position 10. On retry, my app ends up processing element 10 twice, because checkpoint - 1
and resultSet.next()
will effectively set the cursor to position 10 instead of 11.
The JpaItemReader
has the correct positioning behavior. Therefore I'd recommend to just use checkpoint
instead of checkpoint - 1
to reposition the cursor.
from jsr352.
https://issues.jboss.org/browse/JBERET-364 was created to track this issue and fix.
from jsr352.
This issue should be fixed with the above commit. Thanks for reporting it. Let's know if anything else.
from jsr352.
Related Issues (20)
- Update the CODEOWNERS file HOT 4
- Enable Support to get DB Username/Password from enivonment variable for jberet.properties HOT 5
- Fix the random test failures on ubuntu HOT 3
- disable Caucho and PHP script tests
- Fix the random test failure of `purgeInMemoryRepository`
- fix the random test failure: `jobExecutionIdFromIncludeRunningOnes`
- Write a blog post for the new feature: Enable Support to get DB Username/Password from environment variable for `jberet.properties` HOT 1
- Add a `layer-spec` similar to the ones in `resteasy-spring` HOT 3
- Add deployment tests into the project by using the provisioned WildFly server with the update-to-date project module(by using Galleon `feature-pack` or WildFly Channel).
- Upgrade to use JUnit 5
- jberet-core logging database credentials
- jberet.properties: extract other database configuration from environment variables
- Upgrade `jakarta.annotation` API version for the next major release.
- Add WildFly Preview CI Testing.
- Add `version.org.wildfly.plugins.wildfly-maven-plugin` for overriding.
- Remove the dependency of `jakarta.persistence-api`
- Remove the dependency of the `validation-api`
- Consider dropping guava HOT 4
- JdbcRepository doesn't override getJob, jobExists, getJobNames HOT 5
- Support @BatchProperty of type Enum HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsr352.