We remove nodes from the index with index.remove(node). The index is 
initialized at startup with

Index<Node> index = graphDb.index().forNodes("fulltextAllNodes", 
MapUtil.stringMap("provider", "lucene", "type", "fulltext"));

Removing the node from the index before executing node.delete() avoids 
the exception.

Isolating the testcase is difficult, and I don't have the time right 
now. But I can send you a database archive containing a zombie node if 
you like.


Am 17.11.2011 10:35, schrieb Mattias Persson:
> "Removing from index": is that done by looking at properties and removing
> them from the index for every property. If that's the case then this is
> expected since the node has been deleted just before.
>
> 2011/11/17 Peter Neubauer<peter.neuba...@neotechnology.com>
>
>> Axel,
>> Can you isolate this into a test, and maybe send the messages.log off list
>> for us to look at?
>> On Nov 17, 2011 12:09 AM, "Axel Morgner"<a...@morgner.de>  wrote:
>>
>>> Sorry to say, but I can reproduce the behaviour with 1.5, too.
>>>
>>> Without deleting the node from the index manually, I get still this
>>> org.neo4j.kernel.impl.nioneo.store.InvalidRecordException:
>>>
>>> 17.11.2011 00:01:48 org.structr.core.node.TransactionCommand execute
>>> WARNUNG: Transaction failure
>>> org.neo4j.kernel.impl.nioneo.store.InvalidRecordException: Record[46]
>>> not in use
>>>      at
>>>
>> org.neo4j.kernel.impl.nioneo.store.NodeStore.getRecord(NodeStore.java:215)
>>>      at
>>> org.neo4j.kernel.impl.nioneo.store.NodeStore.getRecord(NodeStore.java:96)
>>>      at
>>>
>>>
>> org.neo4j.kernel.impl.nioneo.xa.WriteTransaction.nodeDelete(WriteTransaction.java:683)
>>>      at
>>>
>>>
>> org.neo4j.kernel.impl.persistence.PersistenceManager.nodeDelete(PersistenceManager.java:136)
>>>      at
>>> org.neo4j.kernel.impl.core.NodeManager.deleteNode(NodeManager.java:847)
>>>      at org.neo4j.kernel.impl.core.NodeImpl.delete(NodeImpl.java:266)
>>>      at org.neo4j.kernel.impl.core.NodeProxy.delete(NodeProxy.java:57)
>>>      at
>> org.structr.core.entity.AbstractNode.delete(AbstractNode.java:1358)
>>>      at
>>>
>>>
>> org.structr.rest.constraint.ResourceConstraint$2.execute(ResourceConstraint.java:153)
>>>      at
>>>
>>>
>> org.structr.core.node.TransactionCommand.execute(TransactionCommand.java:61)
>>>      at
>>>
>>>
>> org.structr.rest.constraint.ResourceConstraint.doDelete(ResourceConstraint.java:129)
>>>      at
>>>
>> org.structr.rest.servlet.JsonRestServlet.doDelete(JsonRestServlet.java:188)
>>>      at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
>>>      at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
>>>      at
>>>
>>>
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
>>>      at
>>>
>>>
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>>>      at
>>>
>>>
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
>>>      at
>>>
>>>
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
>>>      at
>>>
>>>
>> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
>>>      at
>>>
>>>
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
>>>      at
>>>
>>>
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
>>>      at
>>> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
>>>      at
>>>
>>>
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
>>>      at
>>>
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:403)
>>>      at
>>>
>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:301)
>>>      at
>>>
>>>
>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:162)
>>>      at
>>>
>>>
>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:140)
>>>      at
>>>
>>>
>> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
>>>      at
>>>
>>>
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>>>      at
>>>
>>>
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>>>      at java.lang.Thread.run(Thread.java:679)
>>>
>>> Interestingly, all node properties (besides id) are empty.
>>>
>>> Greetings
>>>
>>> Axel
>>>
>>>> Sorry, I meant we had this with 1.4.2, but nevertheless I will
>>>> double-check 1.5 now ..
>>>>
>>>>
>>>> Am 16.11.2011 22:28, schrieb Peter Neubauer:
>>>>> Axel,
>>>>> please do, as we have found and squashed a number of potential
>>>>> problems in QA for 1.5 after 1.4.1
>>>>>
>>>>> Cheers,
>>>>>
>>>>> /peter neubauer
>>>>>
>>>>> GTalk:      neubauer.peter
>>>>> Skype       peter.neubauer
>>>>> Phone       +46 704 106975
>>>>> LinkedIn   http://www.linkedin.com/in/neubauer
>>>>> Twitter      http://twitter.com/peterneubauer
>>>>>
>>>>> http://www.neo4j.org              - NOSQL for the Enterprise.
>>>>> http://startupbootcamp.org/    - Öresund - Innovation happens HERE.
>>>>>
>>>>>
>>>>>
>>>>> On Wed, Nov 16, 2011 at 10:27 PM, Axel Morgner<a...@morgner.de>
>>> wrote:
>>>>>> 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