JanusGraph / JanusGraph/janusgraph

JG Schema - addConnection seem to create duplicate connections

Open
#2,950 1 comment 0 reactions 0 assignees View on GitHub
kind/bug/confirmed
Dominant language
Java
Stars
5.8k
Forks
1.2k
Avg merge
13h 53m
Merged PRs (30d)
6

Description

- Version: 0.6
- Storage Backend: Cassandra v3.11.11
- Mixed Index Backend: none
- Link to discussed bug: https://lists.lfaidata.foundation/g/janusgraph-users/message/6334
- Expected Behavior: two connections should be created for "toEdge"
- Current Behavior: four connections are created for "toEdge"
- Steps to Reproduce:
1. Creating dynamic graph and schema
```
map = new HashMap();
map.put("storage.backend","cql");
map.put("storage.hostname","cassandra");
map.put("query.force-index", "false");
map.put("schema.default", "default");
map.put("schema.constraints", "false");
map.put("graph.graphname", "transactionGraph")
ConfiguredGraphFactory.createConfiguration(new MapConfiguration(map));

graph = ConfiguredGraphFactory.open("transactionGraph");
mgmt = graph.openManagement();

transaction = mgmt.makeVertexLabel('transaction').make();
person = mgmt.makeVertexLabel('person').make();
entity = mgmt.makeVertexLabel('entity').make();

fromEdge = mgmt.makeEdgeLabel('FROM').multiplicity(ONE2ONE).make()
mgmt.addConnection(fromEdge, person, transaction)
mgmt.addConnection(fromEdge, entity, transaction)

toEdge = mgmt.makeEdgeLabel('TO').multiplicity(ONE2ONE).make()
mgmt.addConnection(toEdge, transaction, person)
mgmt.addConnection(toEdge, transaction, entity)

mgmt.commit()
```
2. Checking connections of the schema
```
mgmt = graph.openManagement()
edges = mgmt.getRelationTypes(EdgeLabel.class)
fromEdge = edges[0]
toEdge = edges[1]

fromEdge.mappedConnections().size() // as I would expect, it has two connections
toEdge.mappedConnections().size() // why 4 connections are here? I would expect only two connections similarly to the FROM edge
```
3. Note that Marc was able to reproduce the same issue also with inmemory backend (`graph = JanusGraphFactory.open('conf/janusgraph-inmemory.properties')`). See the reply from Marc here https://lists.lfaidata.foundation/g/janusgraph-users/message/6348

Contributor guide

Open the contributing guide

Research direction

Reproduce the schema setup from the issue, first with the in-memory backend and then with Cassandra 3.11.11, and inspect mappedConnections() for the FROM and TO edge labels. Trace why TO reports four connections instead of two; done means both labels report the expected two connections without regressions.

Written by the indexing model from the issue text.

Assessment

Tech stack
cassandra, java
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.