Using neo4j 1.4.1 we had some exceptions like

15.11.2011 18:16:11 org.structr.core.entity.AbstractNode setProperty
WARNUNG: Exception in setProperty
org.neo4j.kernel.impl.nioneo.store.InvalidRecordException: Record[22] 
not in use
at 
org.neo4j.kernel.impl.nioneo.store.NodeStore.getRecord(NodeStore.java:178)
at org.neo4j.kernel.impl.nioneo.store.NodeStore.getRecord(NodeStore.java:95)
at 
org.neo4j.kernel.impl.nioneo.xa.WriteTransaction.nodeLoadProperties(WriteTransaction.java:1043)
at 
org.neo4j.kernel.impl.persistence.PersistenceManager.loadNodeProperties(PersistenceManager.java:114)
at 
org.neo4j.kernel.impl.core.NodeManager.loadProperties(NodeManager.java:675)
at org.neo4j.kernel.impl.core.NodeImpl.loadProperties(NodeImpl.java:115)
at 
org.neo4j.kernel.impl.core.Primitive.ensureFullProperties(Primitive.java:648)
at org.neo4j.kernel.impl.core.Primitive.hasProperty(Primitive.java:283)
at org.neo4j.kernel.impl.core.NodeProxy.hasProperty(NodeProxy.java:150)

The exception was thrown when our new REST API was under heavy load. In 
our testcase, we deleted nodes in a while-true-loop while creating nodes 
in another. After some concurrent requests, the nodes were not cleanly 
auto-removed from the (manual) index. So some nodes were still returned 
by an index search, but the above exception was thrown.

Before fixing, our code for removing looked like this (AbstractNode and 
StructrRelationship are just wrapper classes for Neo's Node and 
Relationship).

                 [...]
                             // 1: delete relationships
                             if(obj instanceof AbstractNode) {
                                 List<StructrRelationship> rels = 
((AbstractNode)obj).getRelationships();
                                 for(StructrRelationship rel : rels) {
                                     success &= rel.delete();
                                 }
                             }

                             // 2: delete object
                             success &= obj.delete();
                 [...]

Removing the node from the index before deleting it resolved the exception.

                 [...]

                             // 1: remove node from index
                             Services.command(securityContext, 
RemoveNodeFromIndex.class).execute(obj);

                             // 2: delete relationships
                             if(obj instanceof AbstractNode) {
                                 List<StructrRelationship> rels = 
((AbstractNode)obj).getRelationships();
                                 for(StructrRelationship rel : rels) {
                                     success &= rel.delete();
                                 }
                             }

                             // 3: delete object
                             success &= obj.delete();
                 [...]
Maybe this helps someone.

Tonight, I will do a test with neo4j 1.5 and report back.


Greetings

Axel

_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to