Can MERGE Statements using an $HOROLOG global index cause a race condition?
UPDATE: Found a reason in my code why this could be occurring. Still it would be interesting to hear what people come back with.
Consider the following MERGE statement.
M ^WORKDELETED(DAYNUM,WKS,ACC,$H,%logname)=^WORK(DAYNUM,WKS,ACC)
Produces output
^WORKDELETED(64165,366,16090404088,"64165,34201","user001")="SOME DATA"
^WORKDELETED(64165,366,16090404088,"64165,34201","user001",0,"LOG")="64163*11:05*user001*64163,39919*~"
<other sub-level nodes omitted>
^WORKDELETED(64165,366,16090404088,"64165,34202","user001")="SOME DATA"
^WORKDELETED(64165,366,16090404088,"64165,34202","user001,0,"LOG")="64163*11:05*user001*64163,39919*~"
<other sub-level nodes omitted>
Notice the $H value changes and the result is that you have duplicate entries in ^WORKDELETED. It seems to occur intermittently, which seems to suggest a race condition whereby the $H value changes mid-merge on some occasions and not on others. Note however that dataset for $H value 64165,34201 is the exact same as 64165,34202 ie. both timestamps contain the exact same data and sub-level nodes - only the $H indexes are different.
Is this a well known problem when you use MERGE statements in this way?