Thanks a lot,

I reported it to the engineering team, let's see what they respond.

Michael

> Am 24.03.2015 um 17:20 schrieb [email protected]:
> 
> I made a little progress on figuring this out.
> 
> The index corruption seems to result from removing the relationship from the 
> index and readding it to the index in the same transaction.
> 
> The index is not corrupted if the application removes the relationship from 
> the index in one transaction and readds it to the index in another 
> transaction.
> 
> Adding these code to the repro in the last email seems to demonstrate this.
> 
>       void unindexRelationship(int leftNickname, int rightNickname) {
>               try (Transaction tx = graphDatabaseService.beginTx()) {
>                       Relationship relationship = 
> getRelationship(leftNickname,
>                                       rightNickname);
>                       unindexRelationship(relationship);
>                       tx.success();
>               } catch (Exception e) {
>                       e.printStackTrace();
>               }
>       }
> 
>       void indexRelationship(int leftNickname, int rightNickname) {
>               try (Transaction tx = graphDatabaseService.beginTx()) {
>                       Relationship relationship = 
> getRelationship(leftNickname,
>                                       rightNickname);
>                       indexRelationship(relationship);
>                       tx.success();
>               } catch (Exception e) {
>                       e.printStackTrace();
>               }
>       }
> 
>       void go() {
>               createEmptyDb();
>               int leftNickname = 1, rightNickname = 2;
>               
>               System.out.println("\nUpdate 1: Create 2 nodes and index their 
> relationship");
>               createAndIndexRelationship(leftNickname, rightNickname);
>               verifyReturnedByQuery(leftNickname, rightNickname, false);
>               verifyReturnedByQuery(leftNickname, rightNickname, true);
> 
>               System.out.println("\nUpdate 2: Unindex the relationship");
>               unindexRelationship(leftNickname, rightNickname);
>               verifyReturnedByQuery(leftNickname, rightNickname, false);
>               verifyReturnedByQuery(leftNickname, rightNickname, true);
> 
>               System.out.println("\nUpdate 3: Index the relationship");
>               indexRelationship(leftNickname, rightNickname);
>               verifyReturnedByQuery(leftNickname, rightNickname, false);
>               verifyReturnedByQuery(leftNickname, rightNickname, true);
>         }
> 
> On Friday, March 20, 2015 at 4:12:11 AM UTC-4, [email protected] wrote:
> Hi,
> 
> I am using Neo4j version 2.1.7 embedded in my Java application using JRE 
> 1.8.0_32
> 
> RelationshipIndex queries with a starting point node seem to work incorrectly 
> with some data.
> 
> For example if I create nodes 1, 2, 3  and 4 and then create relationships 
> 1->2, 1->3 and 1->4:
> 
>     Node leftNode = createNode("1");
>     createAndIndexRelationship(leftNode, createNode("2"));
>     createAndIndexRelationship(leftNode, createNode("3"));
>     createAndIndexRelationship(leftNode, createNode("4"));
> 
> This query returns all three relationships:
> 
>     relationshipIndex.query(QueryContext.numericRange(
>         "updateUnixTime", Long.MIN_VALUE, Long.MAX_VALUE));
> 
> This query returns just the second two of the relationships:
>     relationshipIndex.query(QueryContext.numericRange(
>         "updateUnixTime", Long.MIN_VALUE, Long.MAX_VALUE), leftNode, null);
> 
> I confirmed the existence of the nodes and relationships in the Neo4j 
> webadmin management page.
> The first query confirms that the relationship index contains all of the 
> relationships.
> 
> Sometimes my application works for days without this issue appearing, then it 
> starts happening again.
> Restarting the application does not fix the issue.
> 
> I experimented and learned some seemingly odd but potentially related things:
> If I readd the relationship with a new value for updateUnixTime the 
> relationship does NOT start appearing in the query. 
> If I remove and then readd the relationship with a new value for 
> updateUnixTime in a single transaction the relationship does NOT start 
> appearing in the query. 
> If I remove and then readd the relationship with a new value for 
> updateUnixTime in a two separate transactions the relationship DOES start 
> appearing in the query. 
> 
> 
> I would appreciate if anyone would advise me on potential fixes, workarounds 
> or ways to further debug this and get to the root cause.
> 
> Thank you,
> John
> 
> 
> 
> -- 
> 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] 
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
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.

Reply via email to