Very interesting question, Alex.  Since you've potentially "mutated" the
collection you're Iterating, the "correct" thing to do is to invalidate the
iterator, but I do see the need to meet your functional requirements of
incremental updates.

While I'm not sure it would be ideal, one approach you could possibly take
is to do the deletes on another "worker" thread.  You could a variety of
techniques to get the "work" to those worker thread(s) (queues, etc.), and
in theory, the iterator would continue on with its work on the "old" view of
the graph.  While this could be a big consistency problem for many
applications, if you knew that in your application it would not be, it might
work.  Not sure what happens to iterators in the case of other-thread
commits.


-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of Alex D'Amour
Sent: Friday, July 30, 2010 1:21 PM
To: Neo user discussions
Subject: [Neo4j] Stability of Iterators Across Transactions?

Hello all,

I have an application where I have a node that has several hundred thousand
relationships (this probably needs to be changed). In the application I
iterate over these relationships, and delete a large subset of them. Because
there are so many writes, I want to commit the transaction every few
thousand deletions. The problem is that the getAllRelationships iterator
seems to halt after the first transaction commit.

Clearly, I should reduce the number of relationships that are connected to
this node, but is this the expected behavior? Should iterators be made
stable across transactions, or are they only supposed to be guaranteed
within a transaction?

Thanks,
Alex
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to