• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Can't .... do .... plaid .... So I did this tiny ad instead:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic