Error During Iterating Through Resultset

226 views
Skip to first unread message

nm.bill...@gmail.com

unread,
Dec 7, 2016, 4:54:49 AM12/7/16
to ArangoDB
I'm using ArangoDB 3.1.2. I've a collection with almost 70000 documents (each document is a simple Java class with 8 string properties). Lets call this collection Coll-1. I query all documents in Coll-1, and start iterating through them. For each document, I query an 'edge' collection, and then create another document which I insert in Coll-2. The insert is batch (10 documents) insert.

I've run the above process 10 times, and only once it completed without error. I get the following error during reading.

--
Caused by: com.arangodb.ArangoDBException: Response: 404, Error: 1600 - cursor not found
at com.arangodb.internal.velocystream.Communication.checkError(Communication.java:104) ~[arangodb-java-driver-4.1.0.jar:na]
at com.arangodb.internal.velocystream.CommunicationSync.execute(CommunicationSync.java:122) ~[arangodb-java-driver-4.1.0.jar:na]
at com.arangodb.internal.velocystream.CommunicationSync.execute(CommunicationSync.java:42) ~[arangodb-java-driver-4.1.0.jar:na]
at com.arangodb.internal.ArangoExecutorSync.execute(ArangoExecutorSync.java:58) ~[arangodb-java-driver-4.1.0.jar:na]
at com.arangodb.internal.ArangoExecutorSync.execute(ArangoExecutorSync.java:47) ~[arangodb-java-driver-4.1.0.jar:na]
at com.arangodb.ArangoDatabase$1.next(ArangoDatabase.java:245) ~[arangodb-java-driver-4.1.0.jar:na]
at com.arangodb.internal.ArangoCursorIterator.next(ArangoCursorIterator.java:61) ~[arangodb-java-driver-4.1.0.jar:na]
at com.arangodb.ArangoCursor.next(ArangoCursor.java:110) ~[arangodb-java-driver-4.1.0.jar:na]
--

Besides the above error, the process is very slow. The only time which completed without error, it took 30min to to complete. I've done the same in relational database (except I didn't query any 'edge' collection), and it took 3min to complete.

I appreciate any help on the above issues.

mpv1989

unread,
Dec 7, 2016, 6:10:15 AM12/7/16
to ArangoDB
Hi,

When you iterate over the cursor, the cursor ask the server every 1000 documents (default batch size) for the next 1000 documents. The cursor will be removed on the server automatically after a specific amount of time (time-to-live). When this time expired between your iteration steps you get the error "cursor not found" because it is already deleted. To prevent this you can set the `ttl` (time-to-live in seconds, see http-docu here) in `AqlQueryOptions` to a higher value.

Because of the slow process, it would be helpful if you can share your code.

Best
Mark

nm.bill...@gmail.com

unread,
Dec 7, 2016, 7:56:08 AM12/7/16
to ArangoDB
Thanks Mark for your reply. Your suggestion resolved the cursor issue. However, the whole process still too slow. Do you have any suggestion to speedup the performance?

Regards,
  Nader
--

mpv1989

unread,
Dec 9, 2016, 4:28:59 AM12/9/16
to ArangoDB
Which Java driver version do you use?

If you use version 4.1.0 or above you can collect the objects - you want to insert - and insert them with only one request with:
ArangoCollection.insertDocuments(Collection<T>)

Regards,
Mark
Reply all
Reply to author
Forward
0 new messages