Heim >Datenbank >MySQL-Tutorial > 2014 OLTP Memory Database lock 测试
根据微软的说法,由于内存数据库使用了乐观并发控制,所以事务不需要锁来锁定资源保证一致性。微软认为在内存数据库的事务中冲突和失败是非常少的情况,所以假定
NAME size
name size dbo20480 ix_Int_Val10240
[Description]
request_session_id dm_db_xtp_transactions
request_session_id dm_db_xtp_transactions
dbo
request_session_id dm_db_xtp_transactions
WHERE Id_tb1 = 1
Session2和session3 直接报错,没有等待时间。错误如下:
Msg 41302, Level 16, State 110, Line 15
The current transaction attempted to update a record that has been updatedsince this transaction started. The transaction was aborted.
Msg 3998, Level 16, State 1, Line 12
Uncommittable transaction is detected at the end of the batch. Thetransaction is rolled back.
The statement has been terminated.
这跟普通的数据库是不一样的,在普通数据库中由于session1锁定资源,所以session2和session3都会被block. 所以针对于前面的情况需要有重试机制:
Guidelinesfor Retry Logic for Transactions on Memory-Optimized Tables
OLTP数据库如何做冲突检测可以参考:Transactionsin Memory-Optimized Tables
因为2014数据库研究的还不是太多,自己的理解可能有问题,欢迎大家指正。
本文出自 “关注SQL Server技术” 博客,,请务必保留此出处