gpt4 book ai didi

sql-server - "lock | communication buffer resources"是什么意思?

转载 作者:行者123 更新时间:2023-12-02 00:53:21 24 4
gpt4 key购买 nike

我有一个错误日志报告死锁:

Transaction (Process ID 55) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

我正在尝试重现此错误,但我的标准死锁 SQL 代码会产生不同错误:

Transaction (Process ID 54) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

我想非常清楚地表明我不是在问什么是死锁。我确实了解基础知识。

我的问题是:lock | 的含义是什么?在这种情况下的通信缓冲区资源?什么是“通信缓冲资源”? lock | 有什么意义吗?

我最好的猜测是,当并行线程组合其结果时,会使用通信缓冲区。谁能证实或否认这一点?

我的最终目标是以某种方式触发第一个错误再次发生。

最佳答案

我会将该消息解释为锁定资源或通信缓冲区资源的某些组合上的死锁。 “锁资源”是普通对象锁,“通信缓冲区资源”是用于组合并行查询结果的交换事件。这些在https://blogs.msdn.microsoft.com/bartd/2008/09/24/todays-annoyingly-unwieldy-term-intra-query-parallel-thread-deadlocks/中有进一步描述。其中相关段落是:

An "exchangeEvent" resource indicates the presence of parallelism operators in a query plan. The idea is that the work for an operation like a large scan, sort, or join is divided up so that it can be executed on multiple child threads. There are "producer" threads that do the grunt work and feed sets of rows to "consumers". Intra-query parallel requires signaling between these worker threads: the consumers may have to wait on producers to hand them more data, and the producers may have to wait for consumers to finish processing the last batch of data. Parallelism-related waits show up in SQL DMVs as CXPACKET or EXCHANGE wait types (note that the presence of these wait types is normal and simply indicates the presence of parallel query execution -- by themselves, these waits don't indicate that this type or any other type of deadlock is occurring).

我见过的其中一个死锁图包括一组只有一个 SPID 的进程以及一个对象锁和交换事件图。我猜测消息“事务(进程 ID 55)在与另一个进程的锁 | 通信缓冲区资源上发生死锁,并已被选为死锁受害者。重新运行事务”出现,而不是“内部” -查询并行性导致您的服务器命令(进程 ID #51)死锁。由于对象锁和交换事件的组合,请使用查询提示选项 (maxdop 1) 重新运行没有查询内并行性的查询”,否则自本文撰写以来,该消息在 SQL Server 中已发生更改。

关于sql-server - "lock | communication buffer resources"是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18996157/

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