FIX: Descending Index Scans May Block with High Transaction Isolation (196919)



The information in this article applies to:

  • Microsoft SQL Server 7.0

This article was previously published under Q196919
BUG #: 52498

SYMPTOMS

A descending index scan with a SERIALIZABLE transaction isolation level or a HOLDLOCK hint can hold a lock that prevents inserts greater than the highest value current in the table for the index the scan is performed on.

WORKAROUND

To work around this problem, do not use descending index scans when using a SERIALIZABLE transaction isolation level or a HOLDLOCK hint.

STATUS

Microsoft has confirmed this to be a problem in SQL Server 7.0. This problem has been corrected in U.S. Service Pack 1 for Microsoft SQL Server 7.0. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

232570INF: How to Obtain Service Pack 1 for Microsoft SQL Server 7.0 and Microsoft Data Engine (MSDE) 1.0

For more information, contact your primary support provider.

MORE INFORMATION

The following example queries clarify this problem:

--query 1:

   create table t(x int primary key)
   insert into t values(0)
   insert into t values(2)
   insert into t values(3)
   insert into t values(4)
   insert into t values(6)
   go
   set transaction isolation level serializable
   begin transaction
   go
   select * from t where x < 3 order by x desc
   go
					

--query 2: Run from another connection

   insert into t values(1) -- blocked as expected
   go
					

--query 3: Run from another connection

   insert into t values(5) -- works
   go
   insert into t values(7) -- blocked until query 1 client releases locks
   go
					

The following is the problem lock as reported by the sp_lock stored procedure:


   spid   dbid   ObjId       IndId  Type Resource         Mode     Status
   ------ ------ ----------- ------ ---- ---------------- -------- ------

   7      5      1365579903  1      KEY  (ffffffffffff)   IS-S     GRANT
				

Modification Type:MajorLast Reviewed:3/14/2006
Keywords:kbBug kbfix kbSQLServ700sp1fix KB196919