Re: [Neo] org.neo4j.api.core.NotFoundException: Node[7] not found.

2009-05-14 Thread Johan Svensson
Andreas,

NeoIndexService is built managing a tree inside the node space and is
based on the MultiValueIndex. Single/multi value indexes works better
if you have some specific parts of your domain that needs to be
indexed (ex. see Timeline). If you have the index all properties
problem we recommend using LuceneIndexService.

External search alternatives such as Compass are just as good. Neo4j
is a graph database and not a full text search engine so the plan has
always been to integrate towards other solutions when needed.

Assume LuceneIndexService implementation is thread safe since there is
currently some bug in multi value index :)

But any public API implementation under org.neo4j.* should be thread
safe unless documented otherwise (if not it is considered a bug).

-Johan

On Thu, May 14, 2009 at 12:14 AM, Andreas Guenther
aguent...@flying-orange.com wrote:
 Johan,

 Thanks for opening a ticket. What really is the difference between all
 of the different index implementations and what is the recommendation to
 use either one? I even found a LuceneFulltextIndexService. We are
 currently considering the alternative to use Compass for node id
 indexing. Besides transactional and maybe future Neoclipse search
 features, is there any reason to not consider Neo external search
 functionality?

 I assume all Neo IndexService implementations are thread-safe ;)

 -Andreas

 Johan Svensson wrote:
 Hi Andreas,

 I was able to reproduce this. If I start from a clean db and only
 execute those 2 tests over and over again the 4th run will always fail
 on the multi rollback test. I created a ticket for it
 https://trac.neo4j.org/ticket/168 and will look into it as soon as
 possible.

 Regards,
 -Johan

___
Neo mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


[Neo] org.neo4j.api.core.NotFoundException: Node[7] not found.

2009-05-13 Thread Andreas Guenther
Hi,

I am trying to verify simple transactional behavior of EmbeddedNeo 
together with NeoIndexService and run into a strange and rather 
inconsistent errors. Attached are the relevant parts from a simple Maven 
project I used for testing.  Simply issue 'mvn archetype:create -e 
-DgroupId=com.neo4j.test -DartifactId=transaction' and copy the files 
into the respective folders. Note, that the order in how I execute tests 
are relevant. Furthermore, I tried this with and without Spring 
integration and Neo 1.0-b7, 1.0-b8, and trunk. So, here goes:

[mvn clean install]
This will lead to both test classes failing due to
'org.neo4j.api.core.NotFoundException: Node[7] not found'  exception.

[mvn test -Dtest=org.neo4j.test.TransactionRollbackTest]
Same error as above for this test.

[mvn test -Dtest=org.neo4j.test.TransactionCommitTest]
Surprisingly succeeds.

[mvn test -Dtest=org.neo4j.test.TransactionRollbackTest]
Surprisingly succeeds this time.

[mvn clean install]
Surprisingly succeeds this time for all tests.

Here's also a more detailed example of the exception:

org.neo4j.api.core.NotFoundException: Node[7] not found.
at org.neo4j.impl.core.NodeManager.getNodeForProxy(NodeManager.java:431)
at 
org.neo4j.impl.core.NodeProxy.getSingleRelationship(NodeProxy.java:98)
at org.neo4j.util.btree.TreeNode.getFirstEntry(TreeNode.java:181)
at org.neo4j.util.btree.TreeNode.getEntry(TreeNode.java:398)
at org.neo4j.util.btree.BTree.getAsKeyEntry(BTree.java:341)
at 
org.neo4j.util.index.AbstractIndex.getSingleNodeFor(AbstractIndex.java:393)
at 
org.neo4j.util.index.MultiValueIndex.getSingleNodeFor(MultiValueIndex.java:34)
at 
org.neo4j.util.index.NeoIndexService.getSingleNode(NeoIndexService.java:140)
at 
org.neo4j.test.TransactionRollbackTest.hasNewNode(TransactionRollbackTest.java:66)
at 
org.neo4j.test.TransactionRollbackTest.testProgramaticNeoMultiRollback(TransactionRollbackTest.java:32)

As mentioned above already I tried this test scenario with and without 
the Spring test integration and arrived at the same results. Can anyone 
explain the reason for these inconsistencies or what I am doing wrong?

Help is very much appreciated!

Thank you,
-Andreas


---
package org.neo4j.test;

import org.junit.runner.RunWith;
import org.junit.Test;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
import org.neo4j.api.core.NeoService;
import org.neo4j.api.core.Node;
import org.neo4j.api.core.Transaction;
import org.neo4j.api.core.RelationshipType;
import org.neo4j.util.index.IndexService;

import static junit.framework.Assert.assertTrue;
import static junit.framework.Assert.fail;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {/applicationContext-test.xml})
public class TransactionCommitTest {
@Autowired
protected NeoService neoService = null;

@Autowired
protected IndexService neoIndexService = null;

@Test
public void testProgramaticNeoMultiCommit() {
String testValue = String.valueOf(System.nanoTime());
assertTrue(No node expected, !hasNewNode(testValue));

insertNewNodeAndCommit(testValue);
assertTrue(Node expected, hasNewNode(testValue));

testValue = String.valueOf(System.nanoTime());
assertTrue(No node expected, !hasNewNode(testValue));
   
insertNewNodeAndCommit(testValue);
assertTrue(Node expected, hasNewNode(testValue));
}

private void insertNewNodeAndCommit(String testValue) {
Transaction tx = null;
try {
tx = neoService.beginTx();
Node newNode = neoService.createNode();
newNode.setProperty(id, testValue);
neoService.getReferenceNode().createRelationshipTo(newNode, 
NeoRelationshipTypes.LINKS_TO);
neoIndexService.index(newNode, id, testValue);
tx.success();
} catch (Exception e) {
e.printStackTrace();
fail();
} finally {
tx.finish();
}
}

private boolean hasNewNode(String testValue) {
Transaction tx = null;
Node node = null;
try {
tx = neoService.beginTx();
node = neoIndexService.getSingleNode(id, testValue);
tx.success();
} finally {
tx.finish();
}
return node != null;
}

public static enum NeoRelationshipTypes implements RelationshipType {
LINKS_TO
}
}


---
package org.neo4j.test;

import org.junit.runner.RunWith;
import org.junit.Test;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
import org.neo4j.api.core.NeoService;
import 

Re: [Neo] org.neo4j.api.core.NotFoundException: Node[7] not found.

2009-05-13 Thread Johan Svensson
Hi Andreas,

I was able to reproduce this. If I start from a clean db and only
execute those 2 tests over and over again the 4th run will always fail
on the multi rollback test. I created a ticket for it
https://trac.neo4j.org/ticket/168 and will look into it as soon as
possible.

Regards,
-Johan

On Wed, May 13, 2009 at 8:40 PM, Andreas Guenther
aguent...@flying-orange.com wrote:
 Hi,

 I am trying to verify simple transactional behavior of EmbeddedNeo
 together with NeoIndexService and run into a strange and rather
 inconsistent errors. Attached are the relevant parts from a simple Maven
 project I used for testing.  Simply issue 'mvn archetype:create -e
 -DgroupId=com.neo4j.test -DartifactId=transaction' and copy the files
 into the respective folders. Note, that the order in how I execute tests
 are relevant. Furthermore, I tried this with and without Spring
 integration and Neo 1.0-b7, 1.0-b8, and trunk. So, here goes:

...
___
Neo mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo] org.neo4j.api.core.NotFoundException: Node[7] not found.

2009-05-13 Thread Andreas Guenther
Johan,

Thanks for opening a ticket. What really is the difference between all 
of the different index implementations and what is the recommendation to 
use either one? I even found a LuceneFulltextIndexService. We are 
currently considering the alternative to use Compass for node id 
indexing. Besides transactional and maybe future Neoclipse search 
features, is there any reason to not consider Neo external search 
functionality?

I assume all Neo IndexService implementations are thread-safe ;)

-Andreas

Johan Svensson wrote:
 Hi Andreas,

 I was able to reproduce this. If I start from a clean db and only
 execute those 2 tests over and over again the 4th run will always fail
 on the multi rollback test. I created a ticket for it
 https://trac.neo4j.org/ticket/168 and will look into it as soon as
 possible.

 Regards,
 -Johan

 On Wed, May 13, 2009 at 8:40 PM, Andreas Guenther
 aguent...@flying-orange.com wrote:
   
 Hi,

 I am trying to verify simple transactional behavior of EmbeddedNeo
 together with NeoIndexService and run into a strange and rather
 inconsistent errors. Attached are the relevant parts from a simple Maven
 project I used for testing.  Simply issue 'mvn archetype:create -e
 -DgroupId=com.neo4j.test -DartifactId=transaction' and copy the files
 into the respective folders. Note, that the order in how I execute tests
 are relevant. Furthermore, I tried this with and without Spring
 integration and Neo 1.0-b7, 1.0-b8, and trunk. So, here goes:

 ...
 
 ___
 Neo mailing list
 User@lists.neo4j.org
 https://lists.neo4j.org/mailman/listinfo/user
   

___
Neo mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user