简体   繁体   English

SSIS条件拆分导致死锁错误

[英]SSIS Conditional split results in deadlock error

I have a conditional split in an SSIS job that inserts or updates based on the CDC operation. 我在基于CDC操作插入或更新的SSIS作业中有条件拆分。 The deletes dont actually delete, they just mark the row deleted (so it is also an update statement). 删除实际上并不删除,它们只是将行标记为已删除(因此它也是一条更新语句)。

This is what it looks like: 看起来是这样的:

在此处输入图片说明

And the error message associated with the red x is 与红色x相关的错误消息是

"Transaction (Process ID 67) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.". “事务(进程ID 67)已在另一个进程的锁定资源上死锁,并被选择为死锁受害者。重新运行事务。”

I tried to put an additional input arrow in there, so it only runs one update at a time, but it won't let me. 我试图在其中放置一个附加的输入箭头,因此它一次只运行一个更新,但不允许我这样做。

I suspect FactWaybillTrans is has table lock checked in the destination. 我怀疑FactWaybillTrans是否已在目标位置检查了表锁定。 That's usually what you want when loading large amounts of data. 加载大量数据时通常就是您想要的。 However, since you also want to update the same thing, that is going to conflict with the lock and thus, you get a deadlock. 但是,由于您还想更新同一件事,因此它将与锁冲突,因此,您将遇到死锁。 Even without checking table lock, the default lock could escalate to a full lock. 即使不检查表锁,默认锁也可能升级为完全锁。

I would look to stage my updates to a table ( stage.CDCWaybillUpdates ) and then have an Execute SQL Task fire after the Data Flow. 我希望将我的更新stage.CDCWaybillUpdates到表( stage.CDCWaybillUpdates ),然后在数据流之后触发“执行SQL任务”。 Much cleaner and no opportunity for deadlocks. 更清洁,没有死锁的机会。

You might be able to fake it but it'd be totally unreliable. 您也许可以伪造它,但完全不可靠。 Add a Sort Operation between the NumRowsUpdated and Update. 在NumRowsUpdated和Update之间添加排序操作。 That might be able to induce enough drag so that the OLE DB Destination finishes and releases its lock before the update begins firing. 这可能能够引起足够的阻力,以便OLE DB目标在更新开始之前完成并释放其锁定。 If it doesn't slow it down enough, then sort the same data in the opposite direction. 如果它的速度不够慢,请按相反的方向对相同的数据进行排序。 Terrible, hackish approach but sometimes you have to do the dumb. 糟糕,骇人听闻的方法,但有时您不得不愚蠢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM