Reputation: 13889
I'm a co-founder of a service called Endorphin that uses neo4j to store social graph data. We have an issue with it.
We thought that improving the query will resolve the issue but as it turns out this is not the reason of DB failure because sometimes it returns successfully and sometimes fails with SyntaxException
. We cant see the reason that makes this happen. Sending queries through API results in unsystematic failure of queries whereas when we send same queries using console they work perfectly well.
Details:
The Neo4j version is 1.9.2
We're using Windows Azure, OS Ubuntu 12.04LTS, running in JDK7
System configuration is AMD Opteron(tm) Processor 4171 HE 8 core cpu, memory 14GB, HDD 250 GB + 1TB, the database size is 1GB.
Cache config is the following:
cache_type=gcr
use_memory_mapped_buffers=true
neostore.nodestore.db.mapped_memory=1024M
neostore.relationshipstore.db.mapped_memory=1024M
neostore.propertystore.db.mapped_memory=2048M
neostore.propertystore.db.strings.mapped_memory=1024M
neostore.propertystore.db.arrays.mapped_memory=1024M
I've attached an example of the query and error:
The query was:
start n=node(1341474), oldFriend0 = node(21103),
oldFriend1 = node(21103), oldFriend2 = node(302)
create unique n<-[:Comment{CreatedTime:635082180250000000}]-oldFriend0
create unique n<-[:Comment{CreatedTime:635082713870000000}]-oldFriend1
create unique n<-[:Comment{CreatedTime:635082527270000000}]-oldFriend2
return 1.0 as Val
The response status was: 400 Bad Request
The response from Neo4j (which might include useful detail!) was:
{"message" : "Can't create UNNAMED1 with properties here.
It already exists in this context", "exception" : "SyntaxException", "fullname" : "org.neo4j.cypher.SyntaxException", "stacktrace" :
[ "org.neo4j.cypher.internal.pipes.ExecuteUpdateCommandsPipe$$anonfun$assertNothingIsCreatedWhenItShouldNot$1.apply(ExecuteUpdateCommandsPipe.scala:83)",
"org.neo4j.cypher.internal.pipes.ExecuteUpdateCommandsPipe$$anonfun$assertNothingIsCreatedWhenItShouldNot$1.apply(ExecuteUpdateCommandsPipe.scala:82)",
"scala.collection.immutable.Stream.foreach(Stream.scala:547)",
"org.neo4j.cypher.internal.pipes.ExecuteUpdateCommandsPipe.assertNothingIsCreatedWhenItShouldNot(ExecuteUpdateCommandsPipe.scala
One more example:
The query was:
start n=node(1398749), oldFriend0 = node(6856), oldFriend1 = node(6856),
oldFriend2 = node(6848), oldFriend3 = node(6848), oldFriend4 = node(6848),
oldFriend5 = node(5600), oldFriend6 = node(7245), oldFriend7 = node(223),
oldFriend8 = node(223), oldFriend9 = node(223), oldFriend10 = node(223),
oldFriend11 = node(223), oldFriend12 = node(223), oldFriend13 = node(223),
oldFriend14 = node(223), oldFriend15 = node(7821), oldFriend16 = node(126899),
oldFriend17 = node(7133), oldFriend18 = node(7133), oldFriend19 = node(6844),
oldFriend20 = node(6915) create unique n<-[:Comment{CreatedTime:635094700950000000}]-oldFriend0 create unique n<-[:Comment{CreatedTime:635094783870000000}]-oldFriend1
create unique n<-[:Comment{CreatedTime:635094735780000000}]-oldFriend2
create unique n<-[:Comment{CreatedTime:635094744040000000}]-oldFriend3
create unique n<-[:Comment{CreatedTime:635094744310000000}]-oldFriend4
create unique n<-[:Comment{CreatedTime:635094776820000000}]-oldFriend5
create unique n<-[:Comment{CreatedTime:635094730830000000}]-oldFriend6
create unique n<-[:Comment{CreatedTime:635094731200000000}]-oldFriend7
create unique n<-[:Comment{CreatedTime:635094742500000000}]-oldFriend8
create unique n<-[:Comment{CreatedTime:635094742990000000}]-oldFriend9
create unique n<-[:Comment{CreatedTime:635094743440000000}]-oldFriend10
create unique n<-[:Comment{CreatedTime:635094743840000000}]-oldFriend11
create unique n<-[:Comment{CreatedTime:635094744640000000}]-oldFriend12
create unique n<-[:Comment{CreatedTime:635094749740000000}]-oldFriend13
create unique n<-[:Comment{CreatedTime:635094826130000000}]-oldFriend14
create unique n<-[:Comment{CreatedTime:635094748250000000}]-oldFriend15
create unique n<-[:Comment{CreatedTime:635094708340000000}]-oldFriend16
create unique n<-[:Comment{CreatedTime:635094742320000000}]-oldFriend17
create unique n<-[:Comment{CreatedTime:635094742770000000}]-oldFriend18
create unique n<-[:Comment{CreatedTime:635094692580000000}]-oldFriend19
create unique n<-[:Comment{CreatedTime:635094743430000000}]-oldFriend20
return 1.0 as Val
The response status was: 400 Bad Request
The response from Neo4j (which might include useful detail!) was:
{ "message" : "Can't create UNNAMED1 with properties here.
It already exists in this context", "exception" : "SyntaxException",
"fullname" : "org.neo4j.cypher.SyntaxException",
"stacktrace" : [ "org.neo4j.cypher.internal.pipes.ExecuteUpdateCommandsPipe$$anonfun$assertNothingIsCreatedWhenItShouldNot$1.apply(ExecuteUpdateCommandsPipe.scala:83)",
"org.neo4j.cypher.internal.pipes.ExecuteUpdateCommandsPipe$$anonfun$assertNothingIsCreatedWhenItShouldNot$1.apply(ExecuteUpdateCommandsPipe.scala:82)",
"scala.collection.immutable.Stream.foreach(Stream.scala:547)"
Any help is appreciated. Thanks in advance.
UPD: We're using Neo4jClient for C# to execute the queries. They don't fail via console, but they randomly fail when executed with this driver.
Upvotes: 2
Views: 699
Reputation: 3054
For reference there's this issue that will track progress/findings for this issue: https://github.com/neo4j/neo4j/issues/1040
Upvotes: 0
Reputation: 1297
I'll take a stab at something that might help.
Have you tried sending as a batch of separate statements? See: http://docs.neo4j.org/chunked/stable/rest-api-batch-ops.html
This way you could parameterize it and just send them all at once:
start n=node({destId}), oldFriend=node({oldFriend})
create unique n<-[:Comment {relProps}]-oldFriend
And in the params use:
{CreatedTime:635094700950000000}
Upvotes: 1