To create the entity we are running pure sql and are NOT using 
transactions, this is because within the hook we do...

final ODatabaseDocumentInternal db = 
ODatabaseRecordThreadLocal.INSTANCE.get();
OrientGraph graph = getGraph((ODatabaseDocumentTx) db);

And use this to create a new edge between the newly created smk (just a 
domain concept) and another entity.

If we run this in a transaction the entity gets a temporary orid and 
therefore cannot be connected to anything...!

I see this is not working though! I guess we might have to split this into 
two parts? a create transaction and then an update edges transaction?


On Saturday, June 11, 2016 at 7:24:12 AM UTC+1, odbuser wrote:
>
> Sounds serious.  Is it possibly due to the way that you wrote the hooks?  
> Can you post the hook?  Is there code in there that is not transactional?  
> Are you using sql in the hook or a non-transactional graphdb?
>
>
>
> On Wednesday, June 8, 2016 at 8:22:59 AM UTC-4, Simon White wrote:
>>
>> Affecting 2.1.19
>>
>> We have quite a large database - about a million entries for a particular 
>> vertex. Recently I noticed by chance a duplicate, but surely this is 
>> impossible when there is a unique index?
>>
>> I attempted to rebuild the index but unsurprisingly it fails with an 
>> ORecordDuplicatedException. Upon investigation it appears that there are 
>> many many duplicates - hundreds in fact.
>>
>>
>> I am guessing this is a race condition as we insert the entities via both 
>> Java API and HTTP under heavy load (many threads from several separate 
>> applications). 
>>
>> Possibly unrelated but - when creating one of these entries we run an 
>> onRecordBeforeCreate hook to do some validation and also add a 'date 
>> created' field. This takes milliseconds but under heavy load could it be 
>> enough to throw the index off?
>>
>> This is a very serious issue.
>>
>> Any hints to avoid the problem?
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to