• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring Batch: Commit-Interval not honored after roll back during write

 
vicky chauhan
Ranch Hand
Posts: 41
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

Say my commit interval is 1000.

And during writing I get a error at 990th record which is skippable as per skip policy.

So a rollback will occur and the writer will start again writing the same records from record 1.

However, this time, It is commiting on each record. It does not honour commit interval. This is making the job dead slow.

Why the behavior is like that ?? Am I missing something in my configuration ??

Thanks.
 
Mark Spritzler
ranger
Sheriff
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My question is why does it rollback at all. If you policy is to skip records when an error occurs, to me means, any error, skip and continue on where you left off. Not go back to the first record.

Maybe your configuration for skip or transactions is off. I don't know much more about Spring Batch.

Mark
 
vicky chauhan
Ranch Hand
Posts: 41
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark Spritzler wrote:My question is why does it rollback at all. If you policy is to skip records when an error occurs, to me means, any error, skip and continue on where you left off. Not go back to the first record.

Maybe your configuration for skip or transactions is off. I don't know much more about Spring Batch.

Mark


Hello Mark,

Thanks for the input!!

Spring batch writes to database in chunk/batch -- like 100 records at a time... So in case of an exception, it does not know which item of the 100 resulted in exception... So for the skip policy to work, it rolls back and starts over writing each item at a time... So that the item where error occurred is caught...

My question is, once the item is found, the rest of the items should again be written off as a batch...... which is not happening........

Say there are 1000 records, and error occurred at 4th record.. so once the 4th item is found, the remaining 996 records should be written as a chunk instead of one at a time...

I don't know any configuration is available to make this possible or whether this behavior is missing from spring batch!!

Nik
 
Mark Spritzler
ranger
Sheriff
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah. well if it is doing that, then I recommend opening up a Jira ticket for that at SpringSource for the Batch project.

I actually would first post your question in the Spring Batch forum at http://forum.springsource.org/forumdisplay.php?41-Batch

This way they can tell you if it is a bug or a feature, then if it is a bug, put it into their jira.

Thanks

Mark
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic