Reputation: 333
Gremlin API in Azure Cosmos DB allows us to create vertices in different partitions(p1, p2) with same id(v1). When I created a self edge(e1) for a vertex(v1) in one partition(p1), two edges are getting created for vertices in both the partitions(v1 of p1 and v2 of p2). But actually only one edge must be created for the vertex(v1) of p1. I am using the gremlin version 3.4.10 for edge creation. The same behavior of creating duplicate edges was observed, when added the source and target for a vertex in Azure Portal. Find the JSON for the vertices created below.
[
{
"id": "v1",
"label": "v1",
"type": "vertex",
"properties": {
"_partitionKey": [
{
"id": "v1|_partitionKey",
"value": "v1"
}
]
}
},
{
"id": "v1",
"label": "v1",
"type": "vertex",
"properties": {
"_partitionKey": [
{
"id": "v1|_partitionKey",
"value": "p2"
}
]
}
}
]
Find the JSON for the edges created below
[
{
"id": "1bea8dea-6f10-49f5-bf7a-400894a92aae",
"label": "edge1",
"type": "edge",
"inVLabel": "v1",
"outVLabel": "v1",
"inV": "v1",
"outV": "v1"
},
{
"id": "92c72e30-0bea-4ef9-b3c4-9c3879fb5a42",
"label": "edge1",
"type": "edge",
"inVLabel": "v1",
"outVLabel": "v1",
"inV": "v1",
"outV": "v1"
}
]
I have two problems here
Upvotes: 0
Views: 472
Reputation: 403
Out Edge will get stored along with the vertex. If I have created
v1(p1) --e1--> v2(p2),
then e1 will get stored in the same partition of v1 which is p1. Refer for more information on how partition works in Gremlin API, https://learn.microsoft.com/en-us/azure/cosmos-db/graph-partitioning
Upvotes: 0