upsert not working properly in specific cases
Hello,
We have a upsert utility function in Gremlin that gets a name and a label, then either fetches it if it exists or creates it, then sets it with specific values.
The query looks like this:
It usually works just fine, however in some cases it seems to not find existing vertices that have this label and name combo. It then creates a new vertex which is identical, minus the ID which is generated.
We're only seeing this happen in Neptune - no such occurrences in Tinkerpop's local server/client. We have an old version of Neptune (1.0.3.0) and are in the process of upgrading it to the latest version - could this be the cause? Please advise.
Solution:Jump to solution
There were a number of improvements to the upsert pattern between versions 1.0.3.0 and 1.0.5.0. FWIW, 1.0.3.0 is now deprecated as of Jan 30th of this year.
8 Replies
I'm not sure what might be going on there offhand - anyone else in @neptune have any ideas?
At least the syntax looks right, right? The fold() and unfold() are used correctly here?
yes, i'm not sure why that wouldn't work.
Could these be two concurrent writes and do you have ReadWriteConflictDetection disabled?
No, I doubt it - we're iterating an array of predefined services to check if they exist, and create them if not. This happens only once a day (or unless manually triggered)
Solution
There were a number of improvements to the upsert pattern between versions 1.0.3.0 and 1.0.5.0. FWIW, 1.0.3.0 is now deprecated as of Jan 30th of this year.
Not sure what is happening in this particular case. I'd have to see the actual query against the live data, to be certain. You can always open a case and we can have an engineer take a look.
That's why we're in the upgrade process 😄
I will first see if the upgrade fixes it. The version, as you said, is deprecated. If not, I'll ask our DevOps to open an official case to AWS Neptune.
Thanks!