I have a below simple query which creates a new vertex and adds an edge between old vertex and new vertex in the same query. This query works well most of the times. The strange behavior kicks in when there is heavy load on the system and RUs are exhausted.
g.V('2f9d5fe8-6270-4928-8164-2580ad61e57a').AddE('likes').to(g.AddV('fruit').property('id','1').property('name','apple'))
Under Low/Normal Load the above query creates fruit vertex 1
and creates likes
edge between user
and fruit
. Expected behavior.
Under Heavy load(available RUs are limited) the above query creates fruit
vertex but doesn't create likes
edge between user
and fruit
. Query throws 429
status code. If i try to replay the query then i get 409
since fruit
vertex already exists. This behavior is corrupting the data.
In many places i have g.AddV
inside the query. So all those queries might break under heavy load.
Does it make any difference if i use __.addV
instead of g.AddV
?
UPDATED: using __.addV
doesn't make any difference.
So, is my query wrong? do i need to do upsert
wherever i need to add an edge?