-
Notifications
You must be signed in to change notification settings - Fork 852
Upsert insert errror #2182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
produces 4 writes. Since |
@baslr: I think his point is that UPSERT should de-duplicate it to 1 write. I'm not fully sure, but the reason might be that there is no such edge before the query, so INSERTing is chosen, and it doesn't read from the collection it inserts into during the loop, thus not seeing any duplicates from its point of view and inserting all 4. |
indeed this query inserts only one edge. Normal collections dropping |
@baslr: I did similar query to reproduce issue, but in such a case it works as expected. As you can see from steps which I posted above:
So upsert is somehow affected by previous query which gets objects from database. If you can't debug the issue from explains I provided, I can give you database dump so you can try to replicate it. |
The difference is the value of To simplify, the UPSERT part of query will execute as follows (pseudo code):
In AQL all operations are executed in batches, with batchSize = n (the default value for n is 1000). With The
And that's the reason it works when UPSERTing values from a static array but does not when used in the complex query (which features traversals). The obvious fix would be to set
We are currently planning some changes for the transactions and document lookup internals for a future version, likely 3.3. These changes would likely fix this issue, but they are not there yet. At the moment there is no easy fix or workaround for this, apart from making the original query simpler or splitting it into multiple queries (one that's creating the input data for the UPSERT and one that executes it). |
Thanks for your explanation. It's not big issue for us, I rewrote code logic to use only insert. I would be good idea to add some warning about this behavior to your documentation to UPSERT cmd until it's fixed. |
Uh oh!
There was an error while loading. Please reload this page.
my environment running ArangoDB
I'm using the latest ArangoDB of the respective release series:
On this operating system:
this is an AQL-related issue:
[x] I'm using graph features
I'm issuing AQL via:
I have following query which returns four objects:
When I try to upsert these object with search on _from and _id (all four documents have it same), there shoudl be only one object inserted:
But it's not, there are four object inserted:
When I try to supply four objects from previous query in variable, it works correctly:
Only one object is inserted:
Here are explains for both queries:
Query string:
The text was updated successfully, but these errors were encountered: