JanusGraph / JanusGraph/janusgraph
Creating two instances with the same unique id doesn't throw an exception
- Dominant language
- Java
- Stars
- 5.8k
- Forks
- 1.2k
- Avg merge
- 13h 53m
- Merged PRs (30d)
- 6
Description
For confirmed bugs, please report:
- Version: 0.6.0 (master)
- Storage Backend: inmemory
- Mixed Index Backend: none
- Expected Behavior: `JanusGraphException` should be thrown
- Current Behavior: The instance is created
- Steps to Reproduce:
```
@Test
public void graphShouldNotOpenWithSameInstanceId() {
final Map map = getStorageConfiguration();
map.put(UNIQUE_INSTANCE_ID.toStringWithoutRoot(), NON_UNIQUE_INSTANCE_ID);
final MapConfiguration config = ConfigurationUtil.loadMapConfiguration(map);
final StandardJanusGraph graph1 = new StandardJanusGraph(new GraphDatabaseConfigurationBuilder().build(new CommonsConfiguration(config)));
assertEquals(1, graph1.openManagement().getOpenInstances().size());
assertEquals(NON_UNIQUE_CURRENT_INSTANCE_ID, graph1.openManagement().getOpenInstances().toArray()[0]);
JanusGraphException janusGraphException = assertThrows(JanusGraphException.class, () -> {
final StandardJanusGraph graph2 = new StandardJanusGraph(new GraphDatabaseConfigurationBuilder().build(new CommonsConfiguration(config)));
graph1.close();
});
assertEquals("A JanusGraph graph with the same instance id ["+NON_UNIQUE_INSTANCE_ID+"] is already open. Might required forced shutdown.",
janusGraphException.getMessage());
}
```
Contributor guide
Research direction
Start with the supplied graphShouldNotOpenWithSameInstanceId reproduction and trace StandardJanusGraph construction, GraphDatabaseConfigurationBuilder, and openManagement(). Confirm the inmemory configuration rejects the second graph with the expected JanusGraphException and message, while the existing instance can still be closed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- databases, distributed-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100