Neo4j 2.1.2
SDN 3.1.1.RELEASE
Java 7/ Spring Framework 4
I have a NodeEntity with a Unique property using schema indexes. Under a
multi threaded stress testing scenario we create the “same" node multiple
times and SDN/Neo4j returns the same node ID - good.
At the point we plan to save, a GUID is generated and set into the object
we plan on saving - the caller has no way to know if the entity yet exists
(it’s being created in another thread). In this scenario SDN(?) seems to
perform an Update to the node entity that was created in the other tread
overwriting the existing GUID with the one generated in Thread 2.
The general flow looks as thus:
*1st thread*
node = new UserNode { callerRef “abc.123”, uid “123-aef….”}
template.save(node)
returns id 1 with UID 123-aef
*2nd thread*
node = new UserNode { callerRef “abc.123”, uid “1456-aef….”}
template.save(node)
returns id 1(good) but with UID “1456-aef" set in to it (bad)
Is there a way to have the existing node returned without having it updated
IF the node ID is null? Ideally some kind of immutable property?
// Caller sends two requests to create
// Notional concurrent creates
Thread-14 DEBUG:Creating MetaHeaderNode{id=null,
metaKey='i3V5tDCdTde3dQz7owzHDA', name='testauditx.ABC123X'}
Thread-15 DEBUG: Creating MetaHeaderNode{id=null,
metaKey='jdKOIlmWSbWqOsjbutEGaA', name='testauditx.ABC123X'}
// Node created
Thread-14 DEBUG: MetaHeader created: id=[108]
metaKey=[i3V5tDCdTde3dQz7owzHDA]
// Node updated
Thread-15 DEBUG: MetaHeader created: id=[108]
metaKey=[jdKOIlmWSbWqOsjbutEGaA]
// Test assertion
Assertion fails - Keys don't match! expected:<[i3V5tDCdTde3dQz7owzHD]A> but
was:<[jdKOIlmWSbWqOsjbutEGa]A>
The test passes if I compare by ID, but because the node is updated, the
metaKey is overwritten hence the above failure.
--
You received this message because you are subscribed to the Google Groups
"Neo4j" 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.