gpt4 book ai didi

rollback - Spring 批处理 : Commit-Interval not honored after roll back during write

转载 作者:行者123 更新时间:2023-12-04 06:17:38 24 4
gpt4 key购买 nike

假设我的提交间隔是 1000。

在编写过程中,我在第 990 条记录处收到错误,根据跳过策略可以跳过该错误。

因此会发生回滚,并且作者将再次开始从记录 1 开始写入相同的记录。

但是,这一次,它正在提交每条记录。它不尊重提交间隔。这使工作变得缓慢。

为什么行为是这样??我的配置中是否缺少某些内容?

谢谢。

最佳答案

对于 spring 批处理隔离坏项目,这种行为是强制性的,基本上它回滚块并使用 commit-rate=1 处理/写入每个项目以找到坏项目(在处理器或写入器中)

spring batch forum comment to similar problem

相关部分

--> 5 items read, processing starts
<processor called:15>
<processor called:16>
<processor called:17> will throw an error on write
<processor called:18>
<processor called:19>
<before write:[15, 16, 17, 18, 19]>
<on write error>
--> error on item 17, but it was in the list, lets find it
--> rollback
<before chunk>
--> spring batch goes through all items of the chunk again to find the bad item
--> basically it runs now with commit-rate="1" (only for this chunk)
<processor called:15>
<after write:[15]>
<after chunk>
<before chunk>
<processor called:16>
<after write:[16]>
<after chunk>
<before chunk>
<processor called:17> called again for the bad item, because it's still unknown to spring batch, that this is the bad one
--> no write, because itemWriter.write() was called with the bad item only and did throw an exception (again)
--> but now spring batch knows the bad item
<before chunk>

关于rollback - Spring 批处理 : Commit-Interval not honored after roll back during write,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7025506/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com