Search code examples
gremlinamazon-neptune

AWS Neptune Gremlin mergeE and mergeV don't use PartitionStrategy


It seems like mergeE and mergeV does not respect partition strategy, is this true? I couldn't find any references in the docs

g.withStrategies(new PartitionStrategy(
partitionKey: "d", 
writePartition: "d", 
readPartitions: ["d"]))
.addV('dog').property(T.id, '1').property('name', 'dave')
.addV('dog').property(T.id, '2').property('name', 'jackie')
.mergeE([(T.label):'Sibling',created:'2022-02-07',(Direction.from):'1',(Direction.to):'2'])

In this case, when I use addV, V() returns the 2 vertexes, but E() returns nothing.

g.withStrategies(new PartitionStrategy(
partitionKey: "d", 
writePartition: "d", 
readPartitions: ["d"])).E()

However normal g.E() returns the edge.

If i just use merge to create a node, it also returns nothing

g.withStrategies(new PartitionStrategy(
partitionKey: "f", 
writePartition: "f", 
readPartitions: ["f"]))
.mergeV([(T.id):'1',(T.label):'Dog',name:'fakedog']).V()

but a normal g.V() returns my newly merged node (with no partition associated with it)

Is there a way around this?


Solution

  • Unfortunately, you seem to have stumbled on to a bug. I've created TINKERPOP-2994 for tracking.

    The only workaround until that issues is resolved would be to manually write your partitionKey when using mergeV() and mergeE():

    mergeV([(T.id):'1',(T.label):'Dog',name:'fakedog', '_partition': 'd'])
    

    and then you could use PartitionStrategy on the read easily enough when you do:

    new PartitionStrategy(partitionKey: "_partition", 
                          writePartition: "d", 
                          readPartitions: ["d"]