Announcement Announcement Module
Collapse
No announcement yet.
Commit-Interval not honored after roll back during write Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Commit-Interval not honored after roll back during write

    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.

  • #2
    Originally posted by nikunj_c View Post
    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.
    Hello All,

    Progressed a bit.

    Found that such a behaviour is mandatory for spring batch to isolate the bad item(s), basically it rollbacks the chunk and processes/writes each item with commit-rate=1 to find the bad one (in either processor or writer).

    Ref: http://forum.springsource.org/showth...ht=#post373722

    Ok. Got the point. The rollback will happen as soon as the writer hits the first exception. Say that exception occurs at Record 4 out of 1000 records. So the writer starts writing with commit interval 1 and finds the 4th item. Shouldn't it be good to write the remaining 996 records again as a chunk ?? Is it possible ???

    I got comments from Michael that currently its not possible probably...

    Can someone please help me out with this!!

    Also, if my approach is wrong, what is the correct approach then ??

    Thanks!!
    Nik

    Comment


    • #3
      Hello,

      I had the same problem.

      A solution is to filter bad records with a processor instead of using a skippable exception in the writer.
      Imho, the spring batch documentation does not explain clearly the replay mechanism in case of a skippable exception occurs in the writer, in particular the impact on the chunk processing.

      Regards,
      Yann.

      Comment

      Working...
      X