We have a C# system throwing up an oddity we can't get to the bottom of with SQL (SQL2k5).
The situation is that we have two seperate processes running simultaneously looking at the same table, both running inside their own transaction in two different serviced COM+ components on two different clusters. Both are talking to Order and OrderItem SQL tables. Both are running in READ COMMITTED isolation level.
Job 1: Loading an order and one or more items into these tables.
Job 2: A scheduled task that occurs every few minutes selecting from said tables finding all orders that have been fully processed.
The problem: What we have found is that four times in the past eight months job 2 has reacted to a partially loaded order from job 1, before job 1 has fully completed (as an item on the order has been no stocked, it's at a finished status, so is seen by the job as the rest of the order is yet to load).
From investigation, whilst job 1 is in progress we are unable to do a:
select * from order
once an order has been inserted into it. However, we can do:
select * fromOrder o inner join OrderItem oi on oi.orderid = o.id
at the same time (why is this?).
On investigation replicating the same circumstances we can't get job 2 to see a partially created order from job 1, it does return some rows but never the order being inserted by job 1. However, this is exactly what is happening in our live environment!
Does anyone have an insight into why this is occurring?